-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image mode reset at the end of process method #34
Comments
There was recently merged |
@kravemir Using a processor you will convert all images to the same format, the need is to convert each image to its original format after processing it. |
@fabiocaccamo I now get the difference. Sorry for the wrong suggestion. So, you would need something like
What do you mean by "handled internally"? A processor, or a composition of processor using |
@kravemir exactly, this is how I actually solved the problem, here a custom processor example: class BlackAndWhite(object):
def __init__(self):
self.processor = Adjust(color=0.0)
def process(self, img):
img_mode = img.mode
img = self.processor.process(img)
img = img.convert(img_mode)
return img I think that |
Thank you for this great library.
I'm trying to convert a jpg image to black and white and store it in its original format, but I got the following error:
IOError at ... cannot write mode RGBA as JPEG
The cause is that some processors need to change image mode to perform operations, but doesn't reset it to its init value at the end of the process.
I ended up writing my own filter to preserve image mode:
The text was updated successfully, but these errors were encountered: