[reportlab-users] How can I insert CMYK JPG in CMYK pdf document ?

Chuck Martin cwurld at yahoo.com
Mon Jul 27 09:35:32 EDT 2009


I believe that jpg does not support cmyk. When I want CMYK I use tif.

Since there is no perfect mapping from RGB to CMYK, my images start out as eps with CMYK colors. Then I use ghostscript to convert them to tif. If your images start out as RGB bitmaps, then there is less benefit in converting them to tif.

Chuck


----- Original Message ----
From: KLEIN Stéphane <stephane at harobed.org>
To: reportlab-users at reportlab.com
Sent: Monday, July 27, 2009 8:16:03 AM
Subject: Re: [reportlab-users] How can I insert CMYK JPG in CMYK pdf document ?

Le Mon, 20 Jul 2009 12:33:07 +0000, KLEIN Stéphane a écrit :


> Hi,

>

> I produce CMYK PDF document and I need to insert CMYK JPG file in my

> document.

>

> I've one simple example :

>

> ::

>

> from reportlab.pdfgen import canvas

> from reportlab.lib.units import cm, mm from reportlab.lib.pagesizes

> import A4 from reportlab.pdfgen.pdfimages import PDFImage

>

> c = canvas.Canvas( "test.pdf", pagesize = A4) c.drawString(200, 100,

> "hello.pdf")

>

> img = PDFImage("image_test_cmjn.jpg", 100, 500, 300, 300)

> img.drawInlineImage(c, preserveAspectRatio = True)

>

> c.showPage()

> c.save()

>

> "image_test_cmjn.jpg" is a CMYK image. When I look test.pdf, this image

> appear converted in RGB.

>

> How can I fix this issue ?


I fixed my issue with :

$ convert myfile.jpg -resize 100% myfile.jpg

The "convert" is imagemagick utils.

I don't understand why this fix my issue, maybe error in my jpg...

Regards,
Stephane


_______________________________________________
reportlab-users mailing list
reportlab-users at reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users







More information about the reportlab-users mailing list