coobird / thumbnailator

Thumbnailator - a thumbnail generation library for Java
MIT License
5.14k stars 784 forks source link

Can thumbnailator support HEIC images? #160

Closed yeluowuhen52 closed 3 years ago

yeluowuhen52 commented 3 years ago

Expected behavior

Please describe what you are expecting the library to perform. Support HEIC Images.

Actual behavior

Please describe the actual behavior you are experiencing, including stack trace and other information which would help diagnose the issue. I want to convert HEIC to JPG. No suitable ImageReader found for D:\IMG_20200925_191853.HEIC.

Steps to reproduce the behavior

Please enter step-by-step instructions for reproducing the actual behavior. Including code can be helpful in diagnosing issue, but please keep the code to a minimal that will reproduce the behavior.

Thumbnails.of(new File("D:/IMG_20200925_191853.HEIC")) .imageType(BufferedImage.TYPE_INT_RGB).scale(1).rotate(0).outputFormat("JPG") .toFile(new File("expect.jpg"));

Environment

Please provide vendor and version information for the Operating System, JDK, and Thumbnailator. Please feel free to add any other information which may be pertinent.

coobird commented 3 years ago

Thumbnailator depends on the Java Image I/O API to read and write images. Since Java does not come bundled with a HEIC image reader, you'll need to find a Image I/O API compatible image reader that supports HEIC.

A quick search did not yield any results for an Image I/O HEIC reading plugin, so you'll need to rely on another solution to convert the HEIC images to one supported by default in Java (such as PNG or JPEG) before using Thumbnailator.

yeluowuhen52 commented 3 years ago

Thumbnailator depends on the Java Image I/O API to read and write images. Since Java does not come bundled with a HEIC image reader, you'll need to find a Image I/O API compatible image reader that supports HEIC.

A quick search did not yield any results for an Image I/O HEIC reading plugin, so you'll need to rely on another solution to convert the HEIC images to one supported by default in Java (such as PNG or JPEG) before using Thumbnailator.

Thanks for your reply.Android have the class 'android.graphics.ImageDecoder' whitch can convert HEIF pictures to JPG pictures.