Java 圖像縮放類庫:imgscalr
imgscalr 是一個對圖片進行縮放的 Java 類庫。
- 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.
import static org.imgscalr.Scalr.*; public static BufferedImage createThumbnail(BufferedImage img) { // Create quickly, then smooth and brighten it. img = resize(img, Method.SPEED, 125, OP_ANTIALIAS, OP_BRIGHTER); // Let's add a little border before we return result. return pad(img, 4); }
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!