← Back to team overview

phatch-dev team mailing list archive

[Bug 393253] Re: Save action should convert types before saving

 

I'm still unsure what is the best solution to fix this. I know users can
use the convert action to convert to the right mode. But many times
users are not aware of image modes and won't probably understand this
error and what to do about it.

The optimal solution is to write a function that can deal with all PIL
supported formats and make sure the image has the right mode.
Investigating which format supports which mode is not that hard. I'll go
for that solution unless someone has another opinion about it.

-- 
Save action should convert types before saving
https://bugs.launchpad.net/bugs/393253
You received this bug notification because you are a member of Phatch
Developers, which is subscribed to Phatch.

Status in Phatch = Photo & Batch!: Confirmed

Bug description:
For example if you try to save GIF images as jpg you get this error:

Traceback (most recent call last):
  File "/home/nadia/projects/phatch/phatch/core/api.py", line 283, in apply_action
    photo   = action.apply(photo,setting,cache)
  File "/home/nadia/projects/phatch/phatch/actions/save.py", line 156, in apply
    **options)
  File "/home/nadia/projects/phatch/phatch/core/pil.py", line 555, in save
    raise IOError(message)
IOError: cannot write mode P as JPEG
*

The save action should handle that type of conversions.



References