[Ipe-discuss] Ipe image format

Otfried Cheong otfried at ipe.airpost.net
Sun Jan 5 19:35:37 CET 2014

On 1/5/2014 8:23 PM, Sebastian Kürten wrote:
> I'm working on a program that exports Ipe files. Now I try to insert
> bitmaps via the <bitmap> element and referencing it via <image> later
> in the file. What I did not find out yet is what format the bitmap is
> encoded with.
> Since I did not find any information on the Web, I took a look at what
> Ipe will produce. When I use Ipe to create a file with a bitmap, I get
> encoding="base64", Filter="FlateDecode", BitsPerComponent="8",
> length="x"
> I am able to decode the base64 string to some binary blob of length x,
> but what is the format of the decoded string?

Have you looked at



http://ipe7.sourceforge.net/manual/manual_44.html ?

Ipe deliberately accepts a simpler format than it produces itself, to 
make it easy for other software to produce Ipe-compatible files.

If you just want to include a bitmap in a drawing, the easiest would be 
to say

<image rect="100 100 200 200" width="600" height="400"
   ColorSpace="DeviceRGB" BitsPerComponent="8">

In other words, you don't need the <bitmap> element. you can put the 
bitmap data right inside the <image> element.

If you omit the Filter attribute, then the image data is simply the 
pixels of the image, from top left to bottom right, row by row.  In my 
example I omitted the encoding attribute, and so I provide image data in 
hexadeximal.  So 000000 is a single black pixel, ff0000 a red pixel, 
00ff00 a green pixel, and ffffff a white pixel.

Alternatively you can provide the same data in base64 und give the 
encoding attribute. If you want to use Filter="FlateDecode", you would 
need to first compress the raw image byte stream using zlib and then 
convert it to ASCII (either in hexadecimal or base64).


More information about the Ipe-discuss mailing list