Skip to content
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

javax.imageio.IIOException: Invalid JPEG file structure: two SOF markers #210

Open
dacr opened this issue Aug 6, 2023 · 1 comment
Open

Comments

@dacr
Copy link

dacr commented Aug 6, 2023

Expected behavior

Image being resized, recompressed

Actual behavior

An exception is raised : javax.imageio.IIOException: Invalid JPEG file structure: two SOF markers for a particular photo, success with all previous ones. The original photo is here couldn't upload it as its size is over 10Mb (26Mb).

The photo can be loaded with various software :

  • geeqie => no error returned
  • chrome => no error returned
  • gimp => a warning is shown : image
scala> {
     | Thumbnails
     |           .of(input)
     |           .useExifOrientation(true)
     |           .size(1920, 1920)
     |           .keepAspectRatio(true)
     |           .outputQuality(0.8)
     |           .allowOverwrite(false)
     |           .toFile(output)
     | }
javax.imageio.IIOException: Unsupported marker type 0x7a
  at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native Method)
  at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1382)
  at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1162)
  at net.coobird.thumbnailator.tasks.io.InputStreamImageSource.readImage(Unknown Source)
  at net.coobird.thumbnailator.tasks.io.InputStreamImageSource.read(Unknown Source)
  at net.coobird.thumbnailator.tasks.io.FileImageSource.read(Unknown Source)
  at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.read(Unknown Source)
  at net.coobird.thumbnailator.Thumbnailator.createThumbnail(Unknown Source)
  at net.coobird.thumbnailator.Thumbnails$Builder.toFile(Unknown Source)
  ... 66 elided

Steps to reproduce the behavior

Thumbnails
          .of(input)
          .useExifOrientation(true)
          .size(1920, 1920)
          .keepAspectRatio(true)
          .outputQuality(0.8)
          .allowOverwrite(false)
          .toFile(output)

Environment

  • OS vendor and version: Linux Mint 21 Vanessa - Kernel 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
  • JDK vendor and version: OpenJDK 17.0.8 2023-07-18
  • Thumbnailator version: 0.4.20
@dacr
Copy link
Author

dacr commented Aug 6, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant