play.libs
类 Images

java.lang.Object
  继承者 play.libs.Images

public class Images
extends java.lang.Object

Images utils


嵌套类摘要
static class Images.Captcha
          A captcha image.
 
构造方法摘要
Images()
           
 
方法摘要
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, int x1, int y1, int x2, int y2)
          Crop an image
static void resize(java.io.File originalImage, java.io.File to, int w, int h)
          Resize an image
static void resize(java.io.File originalImage, java.io.File to, int w, int h, boolean keepRatio)
          Resize an image
static java.lang.String toBase64(java.io.File image)
          Encode an image to base64 using a data: URI
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

Images

public Images()
方法详细信息

resize

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

参数:
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)

resize

public static void resize(java.io.File originalImage,
                          java.io.File to,
                          int w,
                          int h,
                          boolean keepRatio)
Resize an image

参数:
originalImage - The image file
to - The destination file
w - The new width (or -1 to proportionally resize) or the maxWidth if keepRatio is true
h - The new height (or -1 to proportionally resize) or the maxHeight if keepRatio is true
keepRatio - : if true, resize will keep the original image ratio and use w and h as max dimensions

crop

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

参数:
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

参数:
image - The image file
返回:
The base64 encoded value
抛出:
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