-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Bitmap ".eps" image have incorrect size and mode #6382
Comments
Interestingly, Pillow would match your expectations, except that the image has a depth of 1. So then instead, it is using 'BoundingBox' instead of 'ImageData', and setting the image to RGB. This behaviour has been in place since PIL. |
When Pillow is reading an EPS image, it is actually just passing the image through Ghostscript. If I run So I think the mode is correctly reflecting the way that Ghostscript renders the image. As for the size, if you would like Pillow to switch to using the size from the ImageData, that seems like a reasonable request. |
@radarhere I am sorry. I do not know ghostscript or PPM. And from wikipedia, ppm appears like a format with RGB color mode. Maybe this is right? (ppm-->pbm) Additional, I find that transparency is always set to False. (Because EPS does not support transparency?). Pillow/src/PIL/EpsImagePlugin.py Line 111 in 5fc3b6e
Pillow/src/PIL/EpsImagePlugin.py Lines 330 to 333 in 5fc3b6e
|
If you would like to load an EPS image with transparency, then you can use the following code. with Image.open("sample.eps") as im:
im.load(transparency=True) The documentation for this is at https://pillow.readthedocs.io/en/stable/releasenotes/8.4.0.html#added-transparency-argument-for-loading-eps-images and https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#eps |
Is the image that you've provided one that could be included in our test suite, and distributed under our Pillow license? Or even better, are you able to provide a smaller image that demonstrates the same problem, also to be part of our test suite and distributed under our license? |
Yes. Use this smaller one(46kb) please. img.mode, img.size --> RGB (72, 48) In Photoshop, the info is : Bitmap (100, 67) |
I've created PR #6499. With it, from PIL import Image
img = Image.open("EPS_Bitmap.eps")
print(img.mode, img.size) # 1 (100, 67) Does that resolve this? |
Great. Thanks for your work! |
Am I doing it the wrong way? This is how I'm using it for now (getting data from %ImageData).Thank you.
EPS_Bitmap.eps.zip
The text was updated successfully, but these errors were encountered: