Are there any java library for thumbnails generation? [closed]

孤人 提交于 2020-01-21 04:16:25

问题


I need some smart enough thumbnail generation lib to use it in my java app. I've found appropriate code here but I'm not sure about possible licensing issues.

Are there any free appropriate libraries?


回答1:


If you split the task "create thumbnail" into three steps, "load image", "scale image" and "save image", you can do it with the standard Java API. You can use the static utility methods in javax.imageio.ImageIO to load and save images and use Image#getScaledInstance(...) to resize the original image. Since the Image you get from getScaledInstance is not a BufferedImage, you have to create a new BufferedImage with the correct size and paint the scaled image into the new BufferedImage before you can use ImageIO to save it.




回答2:


Try thumbnailator: http://code.google.com/p/thumbnailator/. All the code you need to add is:

Thumbnails.of(new File("path/to/directory").listFiles())
    .size(640, 480)
    .outputFormat("jpg")
    .toFiles(Rename.PREFIX_DOT_THUMBNAIL);

It's also fast: https://github.com/coobird/thumbnailator/wiki/Comparison

Good luck




回答3:


For creating thumbnails using API methodology, Scalr.resize("your arguments") would be the best one. Also thumbanilator is an option where you dont have to waste much time of yours in understanding, just call the respective method and enjoy with your output thumbnail. Performance/Quality wise Scalr is best. Quality wise thumbnailator is ok.




回答4:


I've checked his site and there's no mention of license. That could mean trouble. At least in Italy where I live because if there's no explicit permission you can't use works that are not yours.

I would suggest to read this question: Open source Java library to produce webpage thumbnails server-side




回答5:


There is jmagick, a Java Implementation of the popular ImageMagick framework.



来源:https://stackoverflow.com/questions/3450203/are-there-any-java-library-for-thumbnails-generation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!