ImagePixelFormat
Contents
[
Hide
]Inheritance: java.lang.Object
public class ImagePixelFormat
Specifies the pixel format for the generated images of document pages.
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);
Fields
Field | Description |
---|---|
FORMAT_16_BPP_ARGB_1555 | 16 bits per pixel, ARGB. |
FORMAT_16_BPP_RGB_555 | 16 bits per pixel, RGB. |
FORMAT_16_BPP_RGB_565 | 16 bits per pixel, RGB. |
FORMAT_1_BPP_INDEXED | 1 bit per pixel, Indexed. |
FORMAT_24_BPP_RGB | 24 bits per pixel, RGB. |
FORMAT_32_BPP_ARGB | 32 bits per pixel, ARGB. |
FORMAT_32_BPP_P_ARGB | 32 bits per pixel, ARGB, premultiplied alpha. |
FORMAT_32_BPP_RGB | 32 bits per pixel, RGB. |
FORMAT_48_BPP_RGB | 48 bits per pixel, RGB. |
FORMAT_64_BPP_ARGB | 64 bits per pixel, ARGB. |
FORMAT_64_BPP_P_ARGB | 64 bits per pixel, ARGB, premultiplied alpha. |
length |
Methods
Method | Description |
---|---|
fromName(String imagePixelFormatName) | |
getName(int imagePixelFormat) | |
getValues() | |
toString(int imagePixelFormat) |
FORMAT_16_BPP_ARGB_1555
public static int FORMAT_16_BPP_ARGB_1555
16 bits per pixel, ARGB.
FORMAT_16_BPP_RGB_555
public static int FORMAT_16_BPP_RGB_555
16 bits per pixel, RGB.
FORMAT_16_BPP_RGB_565
public static int FORMAT_16_BPP_RGB_565
16 bits per pixel, RGB.
FORMAT_1_BPP_INDEXED
public static int FORMAT_1_BPP_INDEXED
1 bit per pixel, Indexed.
FORMAT_24_BPP_RGB
public static int FORMAT_24_BPP_RGB
24 bits per pixel, RGB.
FORMAT_32_BPP_ARGB
public static int FORMAT_32_BPP_ARGB
32 bits per pixel, ARGB.
FORMAT_32_BPP_P_ARGB
public static int FORMAT_32_BPP_P_ARGB
32 bits per pixel, ARGB, premultiplied alpha.
FORMAT_32_BPP_RGB
public static int FORMAT_32_BPP_RGB
32 bits per pixel, RGB.
FORMAT_48_BPP_RGB
public static int FORMAT_48_BPP_RGB
48 bits per pixel, RGB.
FORMAT_64_BPP_ARGB
public static int FORMAT_64_BPP_ARGB
64 bits per pixel, ARGB.
FORMAT_64_BPP_P_ARGB
public static int FORMAT_64_BPP_P_ARGB
64 bits per pixel, ARGB, premultiplied alpha.
length
public static int length
fromName(String imagePixelFormatName)
public static int fromName(String imagePixelFormatName)
Parameters:
Parameter | Type | Description |
---|---|---|
imagePixelFormatName | java.lang.String |
Returns: int
getName(int imagePixelFormat)
public static String getName(int imagePixelFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
imagePixelFormat | int |
Returns: java.lang.String
getValues()
public static int[] getValues()
Returns: int[]
toString(int imagePixelFormat)
public static String toString(int imagePixelFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
imagePixelFormat | int |
Returns: java.lang.String