Re: Size of PDF with lots of images

Behdad Esfahbod <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On 14-01-17 04:20 AM, Adrian Johnson wrote:
> On 17/01/14 06:45, Simon Sapin wrote:
>> On 16/01/2014 19:57, Adrian Johnson wrote:
>>>> If your images were in a format that the PDF backend supports [2] (which
>>>> includes JPEG but not PNG), you could use cairo_surface_set_mime_data()
>>>> to have cairo store the original image data (almost) as-is in PDF,
>>>> without re-compressing. Although I expect that lossy JPEG may not look
>>>> nice for these specific images.
>>> Yes, jpeg images are the most likely reason for the increase in size.
>>>
>>> I'm not sure what you mean by "lossy JPEG may not look
>>> nice for these specific images". The jpeg data is stored exactly as
>>> provided to cairo_surface_set_mime_data() so there will be no loss of
>>> image quality.
>>
>> Behdad’s images are PNG here, not JPEG. They are computer-generated with
>> sharp edges, the kind where JPEG does not do well.
>>
> 
> I see two jpegs in his git repo.

Yes, the background image is a 0.5MB JPEG. But the other 13.5MB are PNGs.

Now it occurred to me that I also use a surface cache and that's why the
background image wasn't reembedded 150 times!  I was under the impression that
cairo's being smart...  I still think it should try to be smart by hashing
images and reusing them.

-- 
behdad
http://behdad.org/
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.