coobird / thumbnailator

Thumbnailator - a thumbnail generation library for Java
MIT License
5.08k stars 780 forks source link

No suitable ImageReader found for source data(jpeg Picture format) #197

Closed devinliu1 closed 2 years ago

devinliu1 commented 2 years ago

When using thumbnails to add watermarks

Thumbnails. of(inputStream). scale(1). outputQuality(1). toFile(filePath);

Throw exception net coobird. thumbnailator. tasks. UnsupportedFormatException: No suitable ImageReader found for source data

coobird commented 2 years ago

Thumbnailator relies on the Image I/O API's to read/write images. As such, the supported image formats depend on what's available to the Java environment. More information in Which image formats are supported by Thumbnailator)

My guess would be that the file you think is a JPEG is not actually a JPEG. (For example, maybe the file is some other format like WebP but has a .jpg extension.) I can only guess based on the limited information provided.

Once you do find out what kind of image format it is, I would refer you back to the FAQ about supported image formats and see the next steps you can take.

devinliu1 commented 2 years ago

Thank you. The problem has been solved