com.clickntap.utils
Class ImageUtils

java.lang.Object
  extended by com.clickntap.utils.ImageUtils

public class ImageUtils
extends Object


Constructor Summary
ImageUtils()
           
 
Method Summary
static BufferedImage centeredSubImage(BufferedImage bufferedImage, int w, int h)
           
static BufferedImage createImage(int width, int height)
           
static BufferedImage crop(BufferedImage bufferedImage, int w, int h)
           
static BufferedImage cropBottom(BufferedImage bufferedImage, int percentage)
           
static BufferedImage cropRect(BufferedImage bufferedImage)
           
static BufferedImage cropRect(BufferedImage bufferedImage, float ratio)
           
static BufferedImage cropRect(BufferedImage bufferedImage, float ratio, boolean centered)
           
static BufferedImage drawImage(BufferedImage img1, BufferedImage img2)
           
static BufferedImage drawImage(BufferedImage img1, BufferedImage img2, int x, int y, int w, int h)
           
static BufferedImage drawImage(BufferedImage img1, File file)
           
static BufferedImage drawImage(BufferedImage img1, String file)
           
static BufferedImage drawImage(BufferedImage img1, String file, int x, int y, int w, int h)
           
static BufferedImage drawSubImage(BufferedImage img1, BufferedImage img2, int x, int y, int w, int h)
           
static BufferedImage drawSubImage(BufferedImage image, String file, int x, int y, int w, int h)
           
static BufferedImage drawText(BufferedImage image, String s, int x, int y, int width, int height, float linespace, Font font, Color color)
           
static BufferedImage expand(BufferedImage img, int w, int h)
           
static BufferedImage expand(BufferedImage img, int w, int h, int x, int y)
           
static void fillRect(BufferedImage image, Color color)
           
static void fillRect(BufferedImage image, Color color, int x, int y, int w, int h)
           
static Rectangle2D getTextBound(BufferedImage image, String s, Font font)
           
static boolean hasAlpha(Image image)
           
static BufferedImage letterbox(BufferedImage bufferedImage, int width, int height)
           
static BufferedImage letterbox(BufferedImage bufferedImage, int width, int height, Color backColor)
           
static Image mask(BufferedImage img, Color color)
           
static BufferedImage open(File file)
           
static BufferedImage open(InputStream in)
           
static BufferedImage open(String filename)
           
static BufferedImage open(URL url)
           
static BufferedImage rotate(BufferedImage img, double angle)
           
static void saveAs(BufferedImage bufferedImage, File file)
           
static void saveAs(BufferedImage bufferedImage, String fileName)
           
static void saveAs(BufferedImage bufferedImage, String format, OutputStream out)
           
static void saveAsJpeg(BufferedImage image, int quality, OutputStream out)
           
static void saveAsJpeg(BufferedImage image, int quality, String dest)
           
static BufferedImage scale(BufferedImage bufferedImage, float percent)
           
static BufferedImage scale(BufferedImage bufferedImage, int w, int h)
           
static BufferedImage scaleHeight(BufferedImage bufferedImage, int h)
           
static BufferedImage scaleWidth(BufferedImage bufferedImage, int w)
           
static BufferedImage subImage(BufferedImage bufferedImage, int x1, int y1, int x2, int y2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageUtils

public ImageUtils()
Method Detail

rotate

public static BufferedImage rotate(BufferedImage img,
                                   double angle)

mask

public static Image mask(BufferedImage img,
                         Color color)

hasAlpha

public static boolean hasAlpha(Image image)
                        throws Exception
Throws:
Exception

cropRect

public static BufferedImage cropRect(BufferedImage bufferedImage)

cropRect

public static BufferedImage cropRect(BufferedImage bufferedImage,
                                     float ratio)

createImage

public static BufferedImage createImage(int width,
                                        int height)

letterbox

public static BufferedImage letterbox(BufferedImage bufferedImage,
                                      int width,
                                      int height)
                               throws Exception
Throws:
Exception

letterbox

public static BufferedImage letterbox(BufferedImage bufferedImage,
                                      int width,
                                      int height,
                                      Color backColor)
                               throws Exception
Throws:
Exception

drawImage

public static BufferedImage drawImage(BufferedImage img1,
                                      BufferedImage img2,
                                      int x,
                                      int y,
                                      int w,
                                      int h)

drawImage

public static BufferedImage drawImage(BufferedImage img1,
                                      BufferedImage img2)

drawImage

public static BufferedImage drawImage(BufferedImage img1,
                                      String file)
                               throws Exception
Throws:
Exception

drawImage

public static BufferedImage drawImage(BufferedImage img1,
                                      String file,
                                      int x,
                                      int y,
                                      int w,
                                      int h)
                               throws Exception
Throws:
Exception

drawImage

public static BufferedImage drawImage(BufferedImage img1,
                                      File file)
                               throws Exception
Throws:
Exception

drawSubImage

public static BufferedImage drawSubImage(BufferedImage image,
                                         String file,
                                         int x,
                                         int y,
                                         int w,
                                         int h)
                                  throws IOException
Throws:
IOException

drawSubImage

public static BufferedImage drawSubImage(BufferedImage img1,
                                         BufferedImage img2,
                                         int x,
                                         int y,
                                         int w,
                                         int h)

expand

public static BufferedImage expand(BufferedImage img,
                                   int w,
                                   int h)

expand

public static BufferedImage expand(BufferedImage img,
                                   int w,
                                   int h,
                                   int x,
                                   int y)

fillRect

public static void fillRect(BufferedImage image,
                            Color color)

fillRect

public static void fillRect(BufferedImage image,
                            Color color,
                            int x,
                            int y,
                            int w,
                            int h)

cropRect

public static BufferedImage cropRect(BufferedImage bufferedImage,
                                     float ratio,
                                     boolean centered)

cropBottom

public static BufferedImage cropBottom(BufferedImage bufferedImage,
                                       int percentage)

crop

public static BufferedImage crop(BufferedImage bufferedImage,
                                 int w,
                                 int h)

subImage

public static BufferedImage subImage(BufferedImage bufferedImage,
                                     int x1,
                                     int y1,
                                     int x2,
                                     int y2)

centeredSubImage

public static BufferedImage centeredSubImage(BufferedImage bufferedImage,
                                             int w,
                                             int h)

scaleHeight

public static BufferedImage scaleHeight(BufferedImage bufferedImage,
                                        int h)
                                 throws Exception
Throws:
Exception

scaleWidth

public static BufferedImage scaleWidth(BufferedImage bufferedImage,
                                       int w)
                                throws Exception
Throws:
Exception

scale

public static BufferedImage scale(BufferedImage bufferedImage,
                                  int w,
                                  int h)
                           throws Exception
Throws:
Exception

scale

public static BufferedImage scale(BufferedImage bufferedImage,
                                  float percent)
                           throws Exception
Throws:
Exception

saveAs

public static void saveAs(BufferedImage bufferedImage,
                          File file)
                   throws IOException
Throws:
IOException

saveAs

public static void saveAs(BufferedImage bufferedImage,
                          String fileName)
                   throws IOException
Throws:
IOException

saveAs

public static void saveAs(BufferedImage bufferedImage,
                          String format,
                          OutputStream out)
                   throws IOException
Throws:
IOException

open

public static BufferedImage open(String filename)
                          throws IOException
Throws:
IOException

open

public static BufferedImage open(File file)
                          throws IOException
Throws:
IOException

open

public static BufferedImage open(InputStream in)
                          throws IOException
Throws:
IOException

open

public static BufferedImage open(URL url)
                          throws IOException
Throws:
IOException

saveAsJpeg

public static void saveAsJpeg(BufferedImage image,
                              int quality,
                              String dest)
                       throws Exception
Throws:
Exception

saveAsJpeg

public static void saveAsJpeg(BufferedImage image,
                              int quality,
                              OutputStream out)
                       throws Exception
Throws:
Exception

getTextBound

public static Rectangle2D getTextBound(BufferedImage image,
                                       String s,
                                       Font font)

drawText

public static BufferedImage drawText(BufferedImage image,
                                     String s,
                                     int x,
                                     int y,
                                     int width,
                                     int height,
                                     float linespace,
                                     Font font,
                                     Color color)


Copyright © 2014. All rights reserved.