play.libs
Class Images

java.lang.Object
  extended by play.libs.Images

public class Images
extends java.lang.Object

Images utils


Nested Class Summary
static class Images.Captcha
          A captcha image.
 
Constructor Summary
Images()
           
 
Method Summary
static Images.Captcha captcha()
          Create a 150x150 captcha image
static Images.Captcha captcha(int width, int height)
          Create a captche image
static void crop(java.io.File originalImage, java.io.File to, java.lang.Integer x1, java.lang.Integer y1, java.lang.Integer x2, java.lang.Integer y2)
          Crop an image
static void resize(java.io.File originalImage, java.io.File to, java.lang.Integer w, java.lang.Integer h)
          Resize an image
static java.lang.String toBase64(java.io.File image)
          Encode an image to base64 using a data: URI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Images

public Images()
Method Detail

resize

public static void resize(java.io.File originalImage,
                          java.io.File to,
                          java.lang.Integer w,
                          java.lang.Integer h)
Resize an image

Parameters:
originalImage - The image file
to - The destination file
w - The new width (or -1 to proportionally resize)
h - The new height (or -1 to proportionally resize)

crop

public static void crop(java.io.File originalImage,
                        java.io.File to,
                        java.lang.Integer x1,
                        java.lang.Integer y1,
                        java.lang.Integer x2,
                        java.lang.Integer y2)
Crop an image

Parameters:
originalImage - The image file
to - The destination file
x1 - The new x origin
y1 - The new y origin
x2 - The new x end
y2 - The new y end

toBase64

public static java.lang.String toBase64(java.io.File image)
                                 throws java.io.IOException
Encode an image to base64 using a data: URI

Parameters:
image - The image file
Returns:
The base64 encoded value
Throws:
java.io.IOException

captcha

public static Images.Captcha captcha(int width,
                                     int height)
Create a captche image


captcha

public static Images.Captcha captcha()
Create a 150x150 captcha image



Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly