Re: Ipe image format
Otfried Cheong <[email protected]>
| Newsgroups | gmane.comp.graphics.ipe.general |
|---|---|
| Organization | Ipe HQ |
| Message-ID | <[email protected]> |
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_42.html and 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"> 000000ff0000aaff00125c7d..... </image> 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). Cheers, Otfried