jarun / imgp

:camera_flash: Fast batch image resizer and rotator
GNU General Public License v3.0
1.03k stars 50 forks source link

Support converting P mode PNGs #52

Closed yzhs closed 2 years ago

yzhs commented 2 years ago

Figured out the limitation in PIL: P mode PNGs cannot be converted to JPEG. When first converting to RGB(A) mode, it works, though.

Stackoverflow has the answer, as always. :-)

Adds conditional conversion to RGBA mode and removes guards introduced in #30.

Tested locally with this screenshot: stackoverflow_screenshot_img_mode_convert

python imgp --convert --overwrite screenshot.png
# and
python imgp --convert --overwrite --rotate 90 screenshot.png

Fixes #50

jarun commented 2 years ago

Thank you!