mnowak
mnowak

Reputation: 165

Python PIL image saving

I'm new to PIL library and have some problem.

base = Image.open('sam.bmp')
base.save(open('base.bmp', 'w'), 'BMP')

when I execute that block of code, saved image is distorted in some strange way.

original image: original image

opened and saved image: enter image description here

As you can see, I'm not doing any transformations with the image - only load and save. Do you have any clue, why is it working that way?

Upvotes: 6

Views: 6567

Answers (2)

Wuilkys
Wuilkys

Reputation: 21

This works :

base = Image.open('sam.bmp')
base.save('base.bmp')

Upvotes: 2

PsyKzz
PsyKzz

Reputation: 740

As Reti43 said, You just need to use base.save('base.bmp')

Upvotes: 5

Related Questions