0

How do I go about converting a JPG file to BMP using PIL? Tried to use Image.open('ifile.jpg').save('ofile.bmp', 'BMP') but I get a 'bogus header data' when attempting to open the file.

Tried the copy / paste method as described in Convert RGBA PNG to RGB with PIL but it does not work too.

Community
  • 1
  • 1
jhtong
  • 1,529
  • 4
  • 23
  • 34

1 Answers1

1

there is no problem in the code.(i have tried the following code and worked well.) it converts your file to desired format.

import Image
im = Image.open("test.bmp")
im.save("test.jpg", "JPEG")

i think the problem is about Ubuntu. I also met a few times and I think it is a bug. try to open with gimp...

urcm
  • 2,274
  • 1
  • 19
  • 45