Skip to content

Conversation

@Ananyasingh2002
Copy link

I changed the code to make it work with different image types, not just JPEG. Now, the code checks what type of image you're using and saves it in the same format. This way, it won't give you errors if you use a different kind of image.

@Ananyasingh2002
Copy link
Author

Please review the changes.

Copy link
Owner

@kelvins kelvins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Ananyasingh2002, thanks for the contrib, but why should we override the image format the user wants to save? In my opinion it would be better to raise an exception related to unsupported file formats than automatically changing the file format to something else.

Also, I tried it locally and it didn't seem to work. Here's a minimal example if you want to try:

from PIL import Image
image = Image.open("res/image1.jpg")
image.save("output1.png", format="JPEG")

This ☝️ is saving the image as PNG not JPEG (using Pillow 10.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants