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

KLEIN Stéphane stephane at harobed.org
Mon Jul 27 09:16:03 EDT 2009


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




More information about the reportlab-users mailing list