[Image-SIG] Converting TIFF to JPEG

Moodie, Craig CA Moodie.Craig.CA@bhp.com
Fri, 15 Sep 2000 12:00:35 +1100


Hi
    The following are outputs are from my routine myconvert_jpeg.py--- listed below. 
   The first output is when I activate(deactivate the im.save line) the print line to establish that the file has been recognised and its format detail. This works!
C:\>python c:\progra~1\python\Scripts\myconvert_jpeg.py c:\progra~1\python\Scripts\image12194.tif
c:\progra~1\python\Scripts\image12194.tif TIFF 853x603 P

# myconvert_jpeg.py
#
# The Python Imaging Library.
# developed by Frerik Lundh
# convert image files
# to JPEG files
# usage is myconvert_jpeg.py imagefile.* 
# creates imagefile.jpg-----hopefully

import os, sys
import Image

for infile in sys.argv[1:]:
	outfile=os.path.splitext(infile)[0]+".jpg"
	im=Image.open(infile)
	# print infile,im.format,"%dx%d" % im.size,im.mode
	im.save(outfile,"JPEG")

    The second output is the result of when I try to save the tif file as a jpeg file.

C:\>python c:\progra~1\python\Scripts\myconvert_jpeg.py c:\progra~1\python\Scripts\image12194.tif
Traceback (innermost last):
  File "c:\progra~1\python\Scripts\myconvert_jpeg.py", line 19, in ?
    im.save(outfile,"JPEG")
  File "C:\PROGRAM FILES\PYTHON\PIL\Image.py", line 655, in save
    self.load()
  File "C:\PROGRAM FILES\PYTHON\PIL\ImageFile.py", line 125, in load
    self.load_prepare()
  File "C:\PROGRAM FILES\PYTHON\PIL\ImageFile.py", line 175, in load_prepare
    self.im = Image.core.new(self.mode, self.size)
  File "C:\PROGRAM FILES\PYTHON\PIL\Image.py", line 40, in __getattr__
    raise ImportError, "The _imaging C module is not installed"
ImportError: The _imaging C module is not installed

Can anybody tell me what is wrong? I have run the viewer.py script(comes with PIL) with this file and it works!
Incidentally this last message is the same as when you run pilconvert.py(comes with PIL)
		Hopefully
			Craig

EOM 

NOTICE - This message contains information intended only for the use of the addressee named above.  It may also be confidential and/or privileged.  If you are not the intended recipient of this message you are hereby notified that you must not disseminate, copy or take any action in reliance on it.  If you have received this message in error please notify postmaster@bhp.com.