public enum Img extends Enum<Img>
Image utilities
Disclaim: some of the logic in this class comes from https://github.com/playframework/play1/blob/master/framework/src/play/libs/Images.java
| Modifier and Type | Class and Description |
|---|---|
static class |
Img._Load<T extends Img._Load> |
static class |
Img.BinarySourceProcessor<PROCESSOR extends Img.BinarySourceProcessor<PROCESSOR,STAGE>,STAGE extends Img.ProcessorStage<STAGE,PROCESSOR>>
The base class that process two image sources and produce result image
|
static class |
Img.Blur |
static class |
Img.Concatenater |
static class |
Img.Cropper |
static class |
Img.Direction
The direction used to process image
|
static class |
Img.F
The namespace for functions
|
static class |
Img.Filter<FILTER extends Img.Filter<FILTER,STAGE>,STAGE extends Img.ProcessorStage<STAGE,FILTER>> |
static class |
Img.Flip |
static class |
Img.NoiseMaker |
static class |
Img.Processor<PROCESSOR extends Img.Processor<PROCESSOR,STAGE>,STAGE extends Img.ProcessorStage<STAGE,PROCESSOR>>
Base class for image operator function which provides source width, height, ratio parameters on demand
|
static class |
Img.ProcessorStage<STAGE extends Img.ProcessorStage<STAGE,PROCESSOR>,PROCESSOR extends Img.Processor<PROCESSOR,STAGE>> |
static class |
Img.Random |
static class |
Img.Resizer
Resize an image
|
static class |
Img.TextWriter |
| Modifier and Type | Field and Description |
|---|---|
static Color |
COLOR_TRANSPARENT |
static String |
DEF_MIME_TYPE
The default image MIME type when not specified
|
static String |
GIF_MIME_TYPE |
static String |
JPG_MIME_TYPE |
static String |
PNG_MIME_TYPE |
static String |
TRACKING_PIXEL_BASE64
Base64 string of a tracking pixel image in gif format
|
static byte[] |
TRACKING_PIXEL_BYTES
Byte array of a tracking pixel image in gif format
|
| Modifier and Type | Method and Description |
|---|---|
static Img.Blur.Stage |
blur(Lang.Func0<BufferedImage> imageProvider) |
static Img.Concatenater.Stage |
concat(Lang.Func0<BufferedImage> image1) |
static Img.Concatenater.Stage |
concat(Lang.Func0<BufferedImage> image1,
Lang.Func0<BufferedImage> image2) |
static Img.Cropper.Stage |
crop(Lang.Func0<BufferedImage> imageProvider) |
static Img.Flip.Stage |
flip(Lang.Func0<BufferedImage> imageProvider) |
static ImageOutputStream |
os(File file) |
static ImageOutputStream |
os(OutputStream os) |
static BufferedImage |
read(File file) |
static BufferedImage |
read(InputStream is) |
static BufferedImage |
read(URL url) |
static Img.Resizer.Stage |
resize(Lang.Func0<BufferedImage> imageProvider) |
static Img._Load |
source(BufferedImage image) |
static Img._Load |
source(File file) |
static Img._Load |
source(InputStream is) |
static Img._Load |
source(Lang.Func0<BufferedImage> imageProducer) |
static Img._Load |
source(URL url) |
static String |
toBase64(byte[] bytes,
String mimeType)
Encode an image to base64 using a data: URI
|
static String |
toBase64(File image)
Encode an image to base64 using a data: URI
|
static String |
toBase64(InputStream inputStream,
String mimeType)
Encode an image to base64 using a data: URI
|
static Img |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Img[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
static Img.TextWriter.Stage |
watermark(Lang.Func0<BufferedImage> imageProvider) |
public static final String DEF_MIME_TYPE
The default image MIME type when not specified
The value is image/png
public static final String GIF_MIME_TYPE
public static final String PNG_MIME_TYPE
public static final String JPG_MIME_TYPE
public static final Color COLOR_TRANSPARENT
public static final byte[] TRACKING_PIXEL_BYTES
Byte array of a tracking pixel image in gif format
public static final String TRACKING_PIXEL_BASE64
Base64 string of a tracking pixel image in gif format
public static Img[] values()
for (Img c : Img.values()) System.out.println(c);
public static Img valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static Img._Load source(InputStream is)
public static Img._Load source(Lang.Func0<BufferedImage> imageProducer)
public static Img._Load source(BufferedImage image)
public static Img.Resizer.Stage resize(Lang.Func0<BufferedImage> imageProvider)
public static Img.Cropper.Stage crop(Lang.Func0<BufferedImage> imageProvider)
public static Img.Flip.Stage flip(Lang.Func0<BufferedImage> imageProvider)
public static Img.Blur.Stage blur(Lang.Func0<BufferedImage> imageProvider)
public static Img.TextWriter.Stage watermark(Lang.Func0<BufferedImage> imageProvider)
public static Img.Concatenater.Stage concat(Lang.Func0<BufferedImage> image1)
public static Img.Concatenater.Stage concat(Lang.Func0<BufferedImage> image1, Lang.Func0<BufferedImage> image2)
public static String toBase64(File image)
Encode an image to base64 using a data: URI
image - The image filepublic static String toBase64(InputStream inputStream, String mimeType)
Encode an image to base64 using a data: URI
inputStream - The image input streammimeType - The mime type, if not specified then default to DEF_MIME_TYPEpublic static String toBase64(byte[] bytes, String mimeType)
Encode an image to base64 using a data: URI
bytes - The image byte arraymimeType - the mime type, if not specified then default to DEF_MIME_TYPEpublic static ImageOutputStream os(File file)
public static ImageOutputStream os(OutputStream os)
public static BufferedImage read(InputStream is)
public static BufferedImage read(File file)
public static BufferedImage read(URL url)
Copyright © 2014–2021 OSGL (Open Source General Library). All rights reserved.