[Image-SIG] How to convert an Image in RGB to JPG

Shabda Raaj shabda.raaj at gmail.com
Tue Feb 26 14:17:58 CET 2008


This is the code I am trying and errors I get,

>>> image = Image.new(mode='RGB', size = (10, 10))
>>> image.convert('JPG')
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python24\Lib\site-packages\PIL\Image.py", line 612, in convert
    im = im.convert(mode, dither)
ValueError: conversion from RGB to JPG not supported
>>> image.convert('jpg')
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python24\Lib\site-packages\PIL\Image.py", line 612, in convert
    im = im.convert(mode, dither)
ValueError: conversion from RGB to jpg not supported
>>>

Basically I want to create an image, do some drawing on it and get the image
as  byte array. I am obviously missing some basic step, but I can't figure
out what :(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/image-sig/attachments/20080226/65d16536/attachment.htm 


More information about the Image-SIG mailing list