[racket] pdf-dc%: Generating a pdf with image embedded in jpeg format?

From: Daniel Prager (daniel.a.prager at gmail.com)
Date: Mon Dec 8 18:44:24 EST 2014

A few quick experiments suggest that Racket/Cairo can/does embed a png
representation within the pdf, but saves a bitmap with jpeg representation
by expanding out to a more naive format. E.g.

   - Racket -> png: 2738 bytes
   - Racket -> pdf: 2995 bytes
   - png -> ImageMagick -> jpeg: 2024 bytes
   - jpeg -> Racket -> pdf: 8854 bytes!! ;-(

* * *

A bit of Googling gives some confirmation (and hope):

>From 2007 (
http://lists.freedesktop.org/archives/cairo/2007-January/009096.html):

> 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.


The October 2014 release  of Cairo 1.14.0 describes the following feature:

> Support JBIG2 mime data in PDF. This allows embedding of more compressed
> JPEG formats within PDF, rather than including the full uncompressed image.
> See: http://cairographics.org/news/cairo-1.14.0/


* * *

I can't find anything in the online docs about the Cairo API that
explicitly reference JPEG or JBIG2.

Is anyone running Cairo 1.14.0 (or later), and does it "just work" in this
scenario?


Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141209/2681e30a/attachment-0001.html>

Posted on the users mailing list.