public class Images extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Images.Captcha
A captcha image.
|
| Constructor and Description |
|---|
Images() |
| Modifier and Type | Method and Description |
|---|---|
static Images.Captcha |
captcha()
Create a 150x150 captcha image
|
static Images.Captcha |
captcha(int width,
int height)
Create a captche image
|
static void |
crop(File originalImage,
File to,
int x1,
int y1,
int x2,
int y2)
Crop an image
|
static void |
resize(File originalImage,
File to,
int w,
int h)
Resize an image
|
static void |
resize(File originalImage,
File to,
int w,
int h,
boolean keepRatio)
Resize an image
|
static String |
toBase64(File image)
Encode an image to base64 using a data: URI
|
public static void resize(File originalImage, File to, int w, int h)
originalImage - The image fileto - The destination filew - The new width (or -1 to proportionally resize)h - The new height (or -1 to proportionally resize)public static void resize(File originalImage, File to, int w, int h, boolean keepRatio)
originalImage - The image fileto - The destination filew - The new width (or -1 to proportionally resize) or the maxWidth
if keepRatio is trueh - The new height (or -1 to proportionally resize) or the
maxHeight if keepRatio is truekeepRatio - : if true, resize will keep the original image ratio and use w
and h as max dimensionspublic static void crop(File originalImage, File to, int x1, int y1, int x2, int y2)
originalImage - The image fileto - The destination filex1 - The new x originy1 - The new y originx2 - The new x endy2 - The new y endpublic static String toBase64(File image) throws IOException
image - The image fileIOExceptionpublic static Images.Captcha captcha(int width, int height)
public static Images.Captcha captcha()
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly