Imgscalr - a Fast, 100% Java-based Image Manipulation Library
Join the DZone community and get the full member experience.
Join For FreeThis is an FYI kind of tip. Recently, I have been looking for some cool Java libraries for cropping, rotating and resizing images. I was looking for something small, fast, flexible and very easy to use. And I found it at http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/. It main advantages are:
• 100% Java code based on Java2D, no native libraries to install
• Java that works in “headless” environments without special environment variable settings; it just works.
• Because there are no native libraries, you mitigate the risk of native libraries crashing the host VM (e.g. your app server) or thread-contention issues
• Hardware accelerated on supported platforms (uses the optimized Java2D rendering pipeline)
• Fast; not faster than a native-C solution, but still damn fast.
• Simple, simple, simple. A handful of static, 1-word methods you can call. No complex configurations, managers, encoders/decoders or any other nonsense. imgscalr is not a “graphics library”, it is a set of the most commonly used graphic operations, optimized and ready to do your bidding.
Well, per example a resize can be accomplished like this:
• 100% Java code based on Java2D, no native libraries to install
• Java that works in “headless” environments without special environment variable settings; it just works.
• Because there are no native libraries, you mitigate the risk of native libraries crashing the host VM (e.g. your app server) or thread-contention issues
• Hardware accelerated on supported platforms (uses the optimized Java2D rendering pipeline)
• Fast; not faster than a native-C solution, but still damn fast.
• Simple, simple, simple. A handful of static, 1-word methods you can call. No complex configurations, managers, encoders/decoders or any other nonsense. imgscalr is not a “graphics library”, it is a set of the most commonly used graphic operations, optimized and ready to do your bidding.
Well, per example a resize can be accomplished like this:
BufferedImage bimage = Scalr.resize(bimage, Method.QUALITY, Mode.FIT_EXACT, width, height);
This is just one case, but as you can see in javadoc – http://www.thebuzzmedia.com/downloads/software/imgscalr/javadoc/index.html, this is exactly what you need for cropping, rotating and resizing images.
From http://e-blog-java.blogspot.com/2012/02/cropping-rotate-and-resizing-images.html
Library
Opinions expressed by DZone contributors are their own.
Trending
-
Health Check Response Format for HTTP APIs
-
Comparing Cloud Hosting vs. Self Hosting
-
What ChatGPT Needs Is Context
-
Operator Overloading in Java
Comments