OSError: image file is truncated (18 bytes not processed)

I try to search the problem on forum. And i have find a answer like this
but it did not work. anyone help me,thank you.

Here is a same problem ,https://forums.fast.ai/t/oserror-image-file-is-truncated-38-bytes-not-processed/30806
it seems to have not solve.

from PIL import ImageFile

add this at the start of your notebook.

Thank you very much. I have done this but it didn’t work. Meanwhile,i found that this answer can solve IOError not OSError.

I have the same problem as you, I am very upset, I don’t know how to solve it.

1 Like

add this in your notebook

from PIL import ImageFile

and add it in your PIL\ImageFile.py too
you can find the file path in pic 2 i gave in this problem ,the last one error information


Okay, i’ll have a try, thank you

That worked for me!! Thank you!!!

thank you, do you mean, under site_packages PIL/ImageFile, at the beginning of the file add


This worked for me. Thanks you very much! Could you explain what is does? (I’m asuming overwrites some setting in PIL so that truncated images are OK’d?) But if possible could you elaborate? What causes such errors?