-
-
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
cannot identify image file 'xxxx.eps' #7751
Comments
Looking at G14.eps, it contains data after the EOF marker that is causing it to fail. Do you know what software was used to create the problem images?
How are you sure of this? |
Thank you for the reply. I can use Aspose to convert images to JPG, so my understanding is that the images are not damaged. |
Do you know what software was used to create the problem images? |
I'm sorry, I didn't create this EPS file, and I'm not sure which software generated it. |
|
Can I understand that if I delete the content after %%EOF, it will be a correct EPS file? |
Yes. If you would like an immediate solution, you can trim the content after %%EOF like this. import io
from PIL import Image, EpsImagePlugin
with open("./input/G14.eps", "rb") as fp:
prefix = fp.read(4)
if EpsImagePlugin._accept(prefix):
data = prefix+fp.read()
im = Image.open(io.BytesIO(data.split(b"%%EOF")[0]+b"%%EOF"))
else:
fp.seek(0)
im = Image.open(fp)
im.load(scale=4)
im.save("./output/G14.jpg") |
This method works, thank you so much! |
What are your OS, Python and Pillow versions?
Firstly, I am certain that the code can run normally. In the process of converting EPS to JPG, the majority of the conversions are successful, but there are some instances where it fails. However, the EPS images that fail are not corrupted. I can provide one of the failed images, and I would like to know the reasons for the failures and how to resolve them.
eps_Pic.zip
The text was updated successfully, but these errors were encountered: