001
014
015 package com.liferay.portal.kernel.image;
016
017 import java.awt.image.BufferedImage;
018 import java.awt.image.RenderedImage;
019
020 import java.io.File;
021 import java.io.IOException;
022 import java.io.InputStream;
023 import java.io.OutputStream;
024
025 import java.util.concurrent.Future;
026
027
031 public interface ImageTool {
032
033 public static final String TYPE_BMP = "bmp";
034
035 public static final String TYPE_GIF = "gif";
036
037 public static final String TYPE_JPEG = "jpg";
038
039 public static final String TYPE_NOT_AVAILABLE = "na";
040
041 public static final String TYPE_PNG = "png";
042
043 public static final String TYPE_TIFF = "tiff";
044
045 public Future<RenderedImage> convertCMYKtoRGB(byte[] bytes, String type);
046
047 public BufferedImage convertImageType(BufferedImage sourceImage, int type);
048
049 public void encodeGIF(RenderedImage renderedImage, OutputStream os)
050 throws IOException;
051
052 public void encodeWBMP(RenderedImage renderedImage, OutputStream os)
053 throws IOException;
054
055 public BufferedImage getBufferedImage(RenderedImage renderedImage);
056
057 public byte[] getBytes(RenderedImage renderedImage, String contentType)
058 throws IOException;
059
060 public ImageBag read(byte[] bytes) throws IOException;
061
062 public ImageBag read(File file) throws IOException;
063
064 public ImageBag read(InputStream inputStream) throws IOException;
065
066 public RenderedImage scale(RenderedImage renderedImage, int width);
067
068 public RenderedImage scale(
069 RenderedImage renderedImage, int maxHeight, int maxWidth);
070
071 public abstract void write(
072 RenderedImage renderedImage, String contentType, OutputStream os)
073 throws IOException;
074
075 }