coobird / thumbnailator

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

Does Thumbnailator support ico type file? #109

Closed FunkyYang closed 7 years ago

FunkyYang commented 7 years ago

I want use this library to convert ico file and resize it to 16*16 size

actually I use this found it can't do with ico file.that is error No suitable ImageReader found for favicon.ico. it means useing ImageReader read file so it can't do with ico file? this is mine code

    public static  String resizingIamgeWithThumbnails(String filePath){
        if(filePath == null || filePath.equals("")){
            return null;
        }
        File file = new File(filePath);
        try {
            Thumbnails.of(file).size(16, 16).outputFormat("jpg").toFiles(Rename.NO_CHANGE);
        } catch (Exception e) {
           logger.error("resizingImageWithThumbnalis failed "+e.getMessage());
            return null;
        }
        String finalName = filePath+".jpg";
        return finalName;
    }
coobird commented 7 years ago

Thumbnailator uses the image I/O functionality provided by the Java Image I/O API, it does not have support for specific file formats -- that's dependent on your Java environment and any 3rd party image I/O libraries you have loaded.

You can read more about it in the FAQ - Which image formats are supported by Thumbnailator?, where you can find a link to the TwelveMonkeys ImageIO library, which apparently has support for the Microsoft ICO icon format.

Hope that helps. :)

FunkyYang commented 7 years ago

thx