1
14
15 package com.liferay.portal.kernel.image;
16
17 import java.awt.image.BufferedImage;
18 import java.awt.image.RenderedImage;
19
20 import java.io.File;
21 import java.io.IOException;
22 import java.io.OutputStream;
23
24
29 public class ImageProcessorUtil {
30
31 public static BufferedImage convertImageType(
32 BufferedImage sourceImage, int type) {
33
34 return getImageProcessor().convertImageType(sourceImage, type);
35 }
36
37 public static void encodeGIF(RenderedImage renderedImage, OutputStream os)
38 throws IOException {
39
40 getImageProcessor().encodeGIF(renderedImage, os);
41 }
42
43 public static void encodeWBMP(RenderedImage renderedImage, OutputStream os)
44 throws InterruptedException, IOException {
45
46 getImageProcessor().encodeWBMP(renderedImage, os);
47 }
48
49 public static BufferedImage getBufferedImage(RenderedImage renderedImage) {
50 return getImageProcessor().getBufferedImage(renderedImage);
51 }
52
53 public static byte[] getBytes(
54 RenderedImage renderedImage, String contentType)
55 throws IOException {
56
57 return getImageProcessor().getBytes(renderedImage, contentType);
58 }
59
60 public static ImageProcessor getImageProcessor() {
61 return _imageProcessor;
62 }
63
64 public static ImageBag read(File file) throws IOException {
65 return getImageProcessor().read(file);
66 }
67
68 public static ImageBag read(byte[] bytes) throws IOException {
69 return getImageProcessor().read(bytes);
70 }
71
72 public static RenderedImage scale(
73 RenderedImage renderedImage, int maxHeight, int maxWidth) {
74
75 return getImageProcessor().scale(renderedImage, maxHeight, maxWidth);
76 }
77
78 public void setImageProcessor(ImageProcessor imageProcessor) {
79 _imageProcessor = imageProcessor;
80 }
81
82 private static ImageProcessor _imageProcessor;
83
84 }