[cairo] Re: Embeding JPG in PDF

Alp Toker alp at atoker.com
Mon Jan 8 20:57:20 PST 2007


Kristian Høgsberg wrote:
> On 1/8/07, Behdad Esfahbod <behdad at behdad.org> wrote:
>> Hi,
>>
>> So, there's this bug against eog (GNOME image viewer) [1] about images
>> printed to PDF are huge.  The reason of course is that cairo embeds
>> images as PNG.  We need to find a solution to this.
> ...
>> My personal preference is to add just enough API to cairo-pdf.h that a
>> toolkit like pdftk can /integrate/ with cairo, to produce more advanced
>> PDF documents.  That's what we do for text: delegate to pangocairo.
> 
> My thoughts about this is that we could add a function like
> 
> cairo_surface_t
> cairo_pdf_surface_create_from_jpeg(const char *filename);

Maybe there's an opportunity here to integrate some of the lossless 
jpeg rotation, cropping and joining algorithms like 
http://sylvana.net/jpegcrop/jpegtran/ in the form of a jpeg surface that 
can both read from and write to jpeg files?

Cairo provides easily understood API for performing each of those 
operations.

This wouldn't solve any of the big issues that need to be solved in the 
PDF surface today, but it would bring some neat algorithms into the 
mainstream, all done behind the scenes and without any explicit support 
required from application developers. Project for a rainy day.


More information about the cairo mailing list