[cairo] Embedding jpeg in pdf
ajohnson at redneon.com
Mon Jul 14 16:21:10 PDT 2008
Jeff Muizelaar wrote:
> On Mon, Jul 14, 2008 at 02:23:30PM +0000, Benjamin Otte wrote:
>> handling library.
>> Anyway, there's some problems I have with not depending on libjpeg:
>> 1) I think most backends that support JPEG only support a subset. I guess you'd
>> need libjpeg to figure out if the current JPEG data is supported anyway. (The
>> same would likely be true for other image formats, too.)
> This is a interesting issue. The only difference I know about in level
> of support is progressive JPEGs. They are not supported by postscript
> but are supported by PDF 1.3+. I don't think it would be too hard to
> determine whether a jpeg is progressive or not without depending on
> libjpeg. I also assume GDI does not support progressive JPEG but I
> haven't been able to find any information confirming that.
> As for confirming that the JPEG data is actually valid I think it makes
> sense to punt that to the application. Applications will already need to
> do this anyways.
The Adobe technical note at  has a list of which jpeg markers are
supported by PostScript Level 2. Checking for supported markers in cairo
is easy to do. In the patch I wrote for adding jpeg support without
libjpeg there is a function  for extracting the jpeg parameters such
as width and height. It would be easy to extend this to check for the PS
Level 2 supported markers so that the PS surface can fallback to using
LZW if the jpeg is not supported.
More information about the cairo