From: William H. <wb...@un...> - 2012-01-04 15:20:54
|
Hello, I am trying to insert JPEG images into my PDF document. I begin with a JPEG image, convert to Bitmap, and then insert the Bitmap... The resolution of the bitmap image is quite poor compared to the original jpeg. How can I improve the resolution??? iom_logo='path/institute_horizontal.jpg' # 540 X 18 pixels i1=bitmap.jpegimage(iom_logo) c.insert(bitmap.bitmap(36, 765, i1, compressmode=None)) Thanks! Bill |
From: William H. <wb...@un...> - 2012-01-04 21:02:05
|
Hello, I am trying to insert JPEG images into my PDF document. I begin with a JPEG image, convert to Bitmap, and then insert the Bitmap... The resolution of the bitmap image is quite poor compared to the original jpeg. How can I improve the resolution??? iom_logo='path/institute_horizontal.jpg' # 540 X 18 pixels i1=bitmap.jpegimage(iom_logo) c.insert(bitmap.bitmap(36, 765, i1, compressmode=None)) Thanks! Bill |
From: René B. <rba...@fr...> - 2012-01-04 21:10:22
|
Le Wed, 04 Jan 2012 14:01:59 -0700, William Hudspeth <wb...@un...> a écrit : > Hello, > > I am trying to insert JPEG images into my PDF document. I begin with a > JPEG image, convert to Bitmap, and then insert the Bitmap... The > resolution of the bitmap image is quite poor compared to the original > jpeg. How can I improve the resolution??? > > iom_logo='path/institute_horizontal.jpg' # 540 X 18 pixels > i1=bitmap.jpegimage(iom_logo) > c.insert(bitmap.bitmap(36, 765, i1, compressmode=None)) > > Thanks! Bill > > Try to create & insert EPS graphics. > > > -- René Bastian |
From: William H. <w.h...@as...> - 2012-01-04 22:35:20
|
---------- Forwarded message ---------- From: William Henney <w.h...@as...> Date: Wed, Jan 4, 2012 at 4:34 PM Subject: Re: OutSRV [PyX-user] Bitmap resolution To: wb...@un... Hi Bill On Wed, Jan 4, 2012 at 9:20 AM, William Hudspeth <wb...@un...> wrote: > I am trying to insert JPEG images into my PDF document. I begin with a > JPEG image, convert to Bitmap, and then insert the Bitmap... The > resolution of the bitmap image is quite poor compared to the original > jpeg. How can I improve the resolution??? > > iom_logo='path/institute_horizontal.jpg' # 540 X 18 pixels > i1=bitmap.jpegimage(iom_logo) > c.insert(bitmap.bitmap(36, 765, i1, compressmode=None)) I generally load images using PIL. Something like this works for me (and doesn't degrade the image as far as I can see): ------------------------------------------------------------------------------------- import pyx from PIL import Image import sys try: jpgfile = sys.argv[1] im = Image.open(jpgfile) except: print "Usage: python pyx-jpg.py JPEGFILE" sys.exit() nx, ny = im.size bm = pyx.bitmap.bitmap(0, 0, im, width=nx*pyx.unit.x_pt, height=ny*pyx.unit.x_pt) c = pyx.canvas.canvas() c.insert(bm) c.writetofile("pyx-jpg-test.pdf") ---------------------------------------------------------------------------------------- Cheers Will -- Dr William Henney, Centro de Radioastronomía y Astrofísica, Universidad Nacional Autónoma de México, Campus Morelia -- Dr William Henney, Centro de Radioastronomía y Astrofísica, Universidad Nacional Autónoma de México, Campus Morelia |
From: André W. <wo...@us...> - 2012-01-04 22:52:54
Attachments:
smime.p7s
|
Hi William, Am 04.01.2012 um 23:35 schrieb William Henney: > I generally load images using PIL. Something like this works for me I was about to suggest to try the PIL. It is certainly better than using embedding an EPS file. I should note that PyX does not understand much about the jpeg format. It basically copies the JPEG stream into the ouput. Maybe your file contains a preview low-res version of the logo too and PyX does not properly skip this. In case the jpeg file is available to the public, it would be interesting to have a look at it. Best, André -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ |