[cairo] Re: Embeding JPG in PDF
Bill Spitzak
spitzak at d2.com
Fri Jan 12 16:24:23 PST 2007
Pierre wrote:
> Hello Bill,
>
> On 1/12/07, Bill Spitzak <spitzak at d2.com> wrote:
>
>> However the original problem is not solved. Even with the above, a
>> program reading a jpeg in and drawing it on a pdf surface using cairo
>> will result in the jpeg being decompressed and then recompressed. This
>> is lossy and slow. The only way it will happen is if the pdf surface can
>> look at the surface it is copying from and identify that it can get raw
>> jpeg data from it.
>
> My last reply was certainly unclear, let me try to explain it again.
> PDF can embed images (like jpeg) without uncompressing it and without
> doing anything but embed the full jpeg file in an object. All you have
> to do is to detect the format, the color scheme, bpp and dimensions.
> With these informations you can create a XObject and embed the
> _complete_ jpeg file in a stream element without uncompressing it.
Your plan means that any program that wants to write pdfs efficiently
must have special code to draw a jpeg into it. I think the original
request was to make a method by which simple code that displays the
document on screen can, without changes, produce an efficient pdf file.
The idea was that cairo provide a convienent way to make the source be a
jpeg image, and that the pdf writer have code to recognize it and skip
the cairo uncompressing and compositing of the pixels.
More information about the cairo
mailing list