AW: [reportlab-users] cmyk-images
manuela kiesenhofer - next gmbh
m.kiesenhofer at ctm.at
Fri Apr 8 04:59:06 EDT 2005
> manuela kiesenhofer wrote:
>> my name is manuela kiesenhofer
>> and I am working in an internet agenency in linz, austria.
>> I've tested the reportlab opensource libary
>> and I think it's really great!!
>> the only problem is that it seems that the libary doesn't support
>> the usage of cmyk-jpgs or cmyk-tifs.
>> however, has anybody of you found a way to insert cmyk-images
>> into a pdf generated by reportlab?
>> cu, manu
>Heile Manuela, this may be my fault as I programmed the image inclusion
>stuff. JPEG is supposed to be a native format for PDF. Looking at the
>code I see
> if info == 1:
> self.colorSpace = 'DeviceGray'
> elif info == 3:
> self.colorSpace = 'DeviceRGB'
> else: #maybe should generate an error, is this right for CMYK?
> self.colorSpace = 'DeviceCMYK'
> so we are attempting to do CMYK provided this path is followed. The
> filename needs to have an extension .jpeg or .jpg for this to work.
> So 1) are you working from a recent source, 2) are you loading via a
> If not send me a snippet of code and a sample jpeg and I'll attempt to
> figure out what's wrong.
> Robin Becker
thanks for addressing my problem.
1. I'm working with width verion 1.20 (ReportLab_1_20.zip).
2. I try to load the image by filename in two ways, here is my code example:
from reportlab.pdfgen import canvas
from reportlab.platypus import Image
from reportlab.lib.units import cm
# set pdf-filename
canvas = canvas.Canvas("cmyk_test.pdf", bottomup=1)
# fill pdf
# try one way
# try another way
IMG = Image('data/meiseleder_balken_cmyk.jpg', width=6*cm, height=1.5*cm)
w,h = IMG.wrap(6*cm, 1.5*cm)
Unfortunately both jpgs are displayed in the pdf as black box.
More information about the reportlab-users