-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
RGBA convert to CMYK lost dpi and other info #1676
Comments
I can tell you that when the file is being re-read, it looks like the APP0 (JFIF and DPI) and APP1 (EXIF) markers are missing, and the APP14 (Adobe) marker is being read instead.
|
any idea for temporary fix? |
If your use case allows it, the ImageMagick command I mentioned above could serve you well. Otherwise, I doubt that there will be a temporary fix before the actual fix. |
{'jfif': 258, 'jfif_unit': 1, 'adobe': 100, 'jfif_version': (1, 2), 'jfif_density': (350, 350), 'dpi': (350, 350), 'adobe_transform': 100}
but when save ,the info lost ,does it mean that ,the save method has a issue ? |
Yes, that is my current assessment. |
Is the metadata preserved if opening and saving as a plain RGB jpeg? |
from PIL import Image
im = Image.open('Tests/images/pil_sample_rgb.jpg')
im.info.keys()
>>> dict_keys(['exif', 'adobe', 'dpi', 'jfif', 'adobe_transform', 'icc_profile', 'jfif_unit', 'jfif_version', 'jfif_density'])
im.save('test.jpg')
Image.open('test.jpg').info.keys()
>>> dict_keys(['jfif_density', 'jfif_version', 'jfif', 'jfif_unit'])
im.save('test.jpg',dpi=im.info['dpi'])
Image.open('test.jpg').info.keys()
>>> dict_keys(['dpi', 'jfif_density', 'jfif_version', 'jfif', 'jfif_unit'])
im.save('test.jpg',exif=im.info['exif'])
Image.open('test.jpg').info.keys()
>>> dict_keys(['exif', 'jfif_density', 'jfif_version', 'jfif', 'jfif_unit'])
im.save('test.jpg',dpi=im.info['dpi'],exif=im.info['exif'])
Image.open('test.jpg').info.keys()
>>> dict_keys(['exif', 'dpi', 'jfif', 'jfif_unit', 'jfif_version', 'jfif_density']) |
So, it's not CMYK, it's the jpeg encoder. |
yes, it's jpeg encoder. I added resolution info via |
PR #4639 has a fix to resolve this. If that PR is merged in, then it's just a matter of using the from PIL import Image
im = Image.open("in.jpg")
im.save("out.jpg", dpi=im.info['dpi'], exif=im.info['exif']) |
Fixed by #4639. Nice to squash a 4.5 year old bug! |
convert 1.jpg to CMYK
then
The text was updated successfully, but these errors were encountered: