[Ipe-discuss] Include bitmap in ipe XML file

Otfried Cheong otfried at ipe.airpost.net
Thu Apr 4 01:57:32 CEST 2013

> Now when I got everything aligned I thought to include background
> image for reference (which I previously process to extract certain
> features as marks) My problem is that it seems I can't include image
> as file path, but I need to encode it (filter FlateDecode) and hexify
> then store inside XML file. For that purpose I used zlib module
> compression, on png image binary data, but encoded content is not the
> same as content saved from ipe (if I insert same image from ipe GUI
> and save as ipe XML). Header seems same/similar, but not the stream
> and as expected ipe can't read my generated file.

The contents of the <bitmap> or <image> element must be the actual pixel 
data (not a PNG file contents).  Assuming a color image, you need to 
dump the pixel values, starting at the top left, going row by row, until 
the bottom right.

You don't need to compress or base64-encode, just dump the values in 
hexadecimal (so six hexadecimal digits are one RRGGBB pixel).  You can 
include spaces or new-lines, they are ignored.


<bitmap id="1" width="10" height="10" ColorSpace="DeviceRGB" 

This syntax is for Ipe 7, but I'm pretty sure it did not change between 
Ipe 6 and Ipe 7.  Definitely the main point was the same: don't set a 
filter, and include the image contents in hexadecimal (Base-64 encoding 
was added in Ipe 7.0.5).

And of course Ipe 6 is really outdated now - it got obsolete in 2009... 
  Is there any reason why you don't move to Ipe 7?


More information about the Ipe-discuss mailing list