public class ImagePixelFormat
extends java.lang.Object
Examples:
Shows how to select a bit-per-pixel rate with which to render a document to an image.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.getParagraphFormat().setStyle(doc.getStyles().get("Heading 1"));
builder.writeln("Hello world!");
builder.insertImage(getImageDir() + "Logo.jpg");
Assert.assertTrue(new File(getImageDir() + "Logo.jpg").length() < 21000);
// When we save the document as an image, we can pass a SaveOptions object to
// select a pixel format for the image that the saving operation will generate.
// Various bit per pixel rates will affect the quality and file size of the generated image.
ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFormat.PNG);
imageSaveOptions.setPixelFormat(imagePixelFormat);
// We can clone ImageSaveOptions instances.
Assert.assertNotEquals(imageSaveOptions, imageSaveOptions.deepClone());
doc.save(getArtifactsDir() + "ImageSaveOptions.PixelFormat.png", imageSaveOptions);
| Modifier and Type | Field and Description |
|---|---|
static int |
FORMAT_1_BPP_INDEXED
1 bit per pixel, Indexed.
|
static int |
FORMAT_16_BPP_ARGB_1555
16 bits per pixel, ARGB.
|
static int |
FORMAT_16_BPP_RGB_555
16 bits per pixel, RGB.
|
static int |
FORMAT_16_BPP_RGB_565
16 bits per pixel, RGB.
|
static int |
FORMAT_24_BPP_RGB
24 bits per pixel, RGB.
|
static int |
FORMAT_32_BPP_ARGB
32 bits per pixel, ARGB.
|
static int |
FORMAT_32_BPP_P_ARGB
32 bits per pixel, ARGB, premultiplied alpha.
|
static int |
FORMAT_32_BPP_RGB
32 bits per pixel, RGB.
|
static int |
FORMAT_48_BPP_RGB
48 bits per pixel, RGB.
|
static int |
FORMAT_64_BPP_ARGB
64 bits per pixel, ARGB.
|
static int |
FORMAT_64_BPP_P_ARGB
64 bits per pixel, ARGB, premultiplied alpha.
|
static int |
length |
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String imagePixelFormatName) |
static java.lang.String |
getName(int imagePixelFormat) |
static int[] |
getValues() |
static java.lang.String |
toString(int imagePixelFormat) |
public static int FORMAT_16_BPP_RGB_555
public static int FORMAT_16_BPP_RGB_565
public static int FORMAT_16_BPP_ARGB_1555
public static int FORMAT_24_BPP_RGB
public static int FORMAT_32_BPP_RGB
public static int FORMAT_32_BPP_ARGB
public static int FORMAT_32_BPP_P_ARGB
public static int FORMAT_48_BPP_RGB
public static int FORMAT_64_BPP_ARGB
public static int FORMAT_64_BPP_P_ARGB
public static int FORMAT_1_BPP_INDEXED
public static int length