RasterCachedMultipageImage
Inheritance: java.lang.Object, com.aspose.imaging.DisposableObject, com.aspose.imaging.DataStreamSupporter, com.aspose.imaging.Image, com.aspose.imaging.RasterImage, com.aspose.imaging.RasterCachedImage
All Implemented Interfaces: com.aspose.imaging.IMultipageImage
public abstract class RasterCachedMultipageImage extends RasterCachedImage implements IMultipageImage
The raster multipage image
Methods
Method | Description |
---|---|
getHeight() | Gets the image height. |
getWidth() | Gets the image width. |
getBitsPerPixel() | Gets the image bits per pixel count. |
isCached() | Gets a value indicating whether image data is cached currently. |
getPageCount() | Gets the page count. |
getPages() | Gets the pages. |
hasAlpha() | Gets a value indicating whether this instance has alpha. |
hasTransparentColor() | Gets a value indicating whether image has transparent color. |
getImageOpacity() | Gets opacity of this image. |
getBackgroundColor() | Gets a value for the background color. |
setBackgroundColor(Color value) | Sets a value for the background color. |
getXmpData() | Gets XMP data from frame. |
setXmpData(XmpPacketWrapper value) | Sets XMP data from frame. |
getPageExportingAction() | Gets the page exporting action. |
setPageExportingAction(PageExportingAction value) | Sets the page exporting action. |
adjustBrightness(int brightness) | Adjust of a brightness for image. |
adjustContrast(float contrast) | Image contrasting |
adjustGamma(float gammaRed, float gammaGreen, float gammaBlue) | Gamma-correction of an image. |
adjustGamma(float gamma) | Gamma-correction of an image. |
blend(Point origin, RasterImage overlay, Rectangle overlayArea, byte overlayAlpha) | Blends this image instance with the overlay image. |
binarizeFixed(byte threshold) | Binarization of an image with predefined threshold |
binarizeBradley(double brightnessDifference, int windowSize) | Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding |
binarizeBradley(double brightnessDifference) | Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding |
binarizeOtsu() | Binarization of an image with Otsu thresholding |
crop(Rectangle rectangle) | Cropping the image. |
crop(int leftShift, int rightShift, int topShift, int bottomShift) | Crop image with shifts. |
dither(int ditheringMethod, int bitsCount, IColorPalette customPalette) | Performs dithering on the current image. |
grayscale() | Transformation of an image to its grayscale representation |
rotate(float angle, boolean resizeProportionally, Color backgroundColor) | RasterCachedMultipageImage.rotate image around the center. |
rotateFlip(int rotateFlipType) | Rotates, flips, or rotates and flips all pages. |
rotateFlipAll(int rotateFlip) | Rotates the flip all. |
resize(int newWidth, int newHeight, int resizeType) | Resizes the image. |
resize(int newWidth, int newHeight, ImageResizeSettings settings) | Resizes the image. |
resizeWidthProportionally(int newWidth, int resizeType) | Resizes the width proportionally. |
resizeHeightProportionally(int newHeight, int resizeType) | Resizes the width proportionally. |
replaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb) | Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges. |
replaceNonTransparentColors(int newColorArgb) | Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges. |
filter(Rectangle rectangle, FilterOptionsBase options) | Filters the specified rectangle. |
normalizeAngle(boolean resizeProportionally, Color backgroundColor) | Normalizes the angle. |
cacheData() | Caches the data private. |
Example: The following example shows batch conversion before saving (exporting) Tiff images.
String fileName = "10MB_Tif.tif";
String inputFileName = fileName;
String outputFileNameTif = "output.tif";
//The possibility of batch conversion before saving (exporting) Tiff images is implemented.
try(com.aspose.imaging.fileformats.tiff.TiffImage tiffImage = (com.aspose.imaging.fileformats.tiff.TiffImage) com.aspose.imaging.Image.load(inputFileName))
{
// Set batch operation for pages
tiffImage.setPageExportingAction(new PageExportingAction()
{
@Override
public void invoke(int pageIndex, Image page)
{
// Fires garbage collection to avoid unnecessary garbage storage from previous pages
System.gc();
((com.aspose.imaging.RasterImage) page).rotate(90);
}
});
tiffImage.save(outputFileNameTif);
/* Attention! In batch mode all pages will be released in this line!
If you want to further perform operations on the original image, you should reload it from the source to another instance. */
}
getHeight()
public int getHeight()
Gets the image height.
Value: The image height.
Returns: int - the image height.
getWidth()
public int getWidth()
Gets the image width.
Value: The image width.
Returns: int - the image width.
getBitsPerPixel()
public int getBitsPerPixel()
Gets the image bits per pixel count.
Value: The image bits per pixel count.
Returns: int - the image bits per pixel count.
isCached()
public boolean isCached()
Gets a value indicating whether image data is cached currently.
Value: true
if image data is cached; otherwise, false
.
Returns: boolean - a value indicating whether image data is cached currently.
getPageCount()
public abstract int getPageCount()
Gets the page count.
Value: The page count.
Returns: int - the page count.
getPages()
public abstract Image[] getPages()
Gets the pages.
Value: The pages.
Returns: com.aspose.imaging.Image[] - the pages.
hasAlpha()
public boolean hasAlpha()
Gets a value indicating whether this instance has alpha.
Value: true
if this instance has alpha; otherwise, false
.
Returns: boolean - a value indicating whether this instance has alpha.
hasTransparentColor()
public boolean hasTransparentColor()
Gets a value indicating whether image has transparent color.
Returns: boolean - a value indicating whether image has transparent color.
getImageOpacity()
public float getImageOpacity()
Gets opacity of this image.
Value: The opacity value between 0.0 (fully transparent) and 1.0 (fully opaque).
Returns: float - opacity of this image.
getBackgroundColor()
public Color getBackgroundColor()
Gets a value for the background color.
Returns: Color - a value for the background color.
setBackgroundColor(Color value)
public void setBackgroundColor(Color value)
Sets a value for the background color.
Parameters:
Parameter | Type | Description |
---|---|---|
value | Color | a value for the background color. |
getXmpData()
public XmpPacketWrapper getXmpData()
Gets XMP data from frame.
Value: XMP packet data wrapper
Returns: XmpPacketWrapper - XMP data from frame.
setXmpData(XmpPacketWrapper value)
public void setXmpData(XmpPacketWrapper value)
Sets XMP data from frame.
Value: XMP packet data wrapper
Parameters:
Parameter | Type | Description |
---|---|---|
value | XmpPacketWrapper | XMP data from frame. |
getPageExportingAction()
public PageExportingAction getPageExportingAction()
Gets the page exporting action. Please note that setting this method will automatically release page resources after it is executed. It will be executed just before each page is saved.
Value: The page exporting action.
Returns: PageExportingAction - the page exporting action.
setPageExportingAction(PageExportingAction value)
public void setPageExportingAction(PageExportingAction value)
Sets the page exporting action. Please note that setting this method will automatically release page resources after it is executed. It will be executed just before each page is saved.
Value: The page exporting action.
Parameters:
Parameter | Type | Description |
---|---|---|
value | PageExportingAction | the page exporting action. |
adjustBrightness(int brightness)
public void adjustBrightness(int brightness)
Adjust of a brightness
for image.
Parameters:
Parameter | Type | Description |
---|---|---|
brightness | int | Brightness value. |
adjustContrast(float contrast)
public void adjustContrast(float contrast)
Image contrasting
Parameters:
Parameter | Type | Description |
---|---|---|
contrast | float | Contrast value (in range [-100; 100]) |
adjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
public void adjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Gamma-correction of an image.
Parameters:
Parameter | Type | Description |
---|---|---|
gammaRed | float | Gamma for red channel coefficient |
gammaGreen | float | Gamma for green channel coefficient |
gammaBlue | float | Gamma for blue channel coefficient |
adjustGamma(float gamma)
public void adjustGamma(float gamma)
Gamma-correction of an image.
Parameters:
Parameter | Type | Description |
---|---|---|
gamma | float | Gamma for red, green and blue channels coefficient |
blend(Point origin, RasterImage overlay, Rectangle overlayArea, byte overlayAlpha)
public void blend(Point origin, RasterImage overlay, Rectangle overlayArea, byte overlayAlpha)
Blends this image instance with the overlay
image.
Parameters:
Parameter | Type | Description |
---|---|---|
origin | Point | The background image blending origin. |
overlay | RasterImage | The overlay image. |
overlayArea | Rectangle | The overlay area. |
overlayAlpha | byte | The overlay alpha. |
binarizeFixed(byte threshold)
public void binarizeFixed(byte threshold)
Binarization of an image with predefined threshold
Parameters:
Parameter | Type | Description |
---|---|---|
threshold | byte | Threshold value. If corresponding gray value of a pixel is greater than threshold, a value of 255 will be assigned to it, 0 otherwise. |
binarizeBradley(double brightnessDifference, int windowSize)
public void binarizeBradley(double brightnessDifference, int windowSize)
Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding
Parameters:
Parameter | Type | Description |
---|---|---|
brightnessDifference | double | The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel. |
windowSize | int | The size of s x s window of pixels centered around this pixel |
binarizeBradley(double brightnessDifference)
public void binarizeBradley(double brightnessDifference)
Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding
Parameters:
Parameter | Type | Description |
---|---|---|
brightnessDifference | double | The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel. |
binarizeOtsu()
public void binarizeOtsu()
Binarization of an image with Otsu thresholding
crop(Rectangle rectangle)
public void crop(Rectangle rectangle)
Cropping the image.
Parameters:
Parameter | Type | Description |
---|---|---|
rectangle | Rectangle | The rectangle. |
crop(int leftShift, int rightShift, int topShift, int bottomShift)
public void crop(int leftShift, int rightShift, int topShift, int bottomShift)
Crop image with shifts.
Parameters:
Parameter | Type | Description |
---|---|---|
leftShift | int | The left shift. |
rightShift | int | The right shift. |
topShift | int | The top shift. |
bottomShift | int | The bottom shift. |
dither(int ditheringMethod, int bitsCount, IColorPalette customPalette)
public void dither(int ditheringMethod, int bitsCount, IColorPalette customPalette)
Performs dithering on the current image.
Parameters:
Parameter | Type | Description |
---|---|---|
ditheringMethod | int | The dithering method. |
bitsCount | int | The final bits count for dithering. |
customPalette | IColorPalette | The custom palette for dithering. |
grayscale()
public void grayscale()
Transformation of an image to its grayscale representation
rotate(float angle, boolean resizeProportionally, Color backgroundColor)
public void rotate(float angle, boolean resizeProportionally, Color backgroundColor)
RasterCachedMultipageImage.rotate
image around the center.
Parameters:
Parameter | Type | Description |
---|---|---|
angle | float | The rotation angle in degrees. Positive values will rotate clockwise. |
resizeProportionally | boolean | if set to true you will have your image size changed according to rotated rectangle (corner points) projections in other case that leaves dimensions untouched and only `` image contents are rotated. |
backgroundColor | Color | Color of the background. |
rotateFlip(int rotateFlipType)
public void rotateFlip(int rotateFlipType)
Rotates, flips, or rotates and flips all pages.
Parameters:
Parameter | Type | Description |
---|---|---|
rotateFlipType | int | The rotation flip type. |
rotateFlipAll(int rotateFlip)
public void rotateFlipAll(int rotateFlip)
Rotates the flip all.
Parameters:
Parameter | Type | Description |
---|---|---|
rotateFlip | int | The rotation flip. |
resize(int newWidth, int newHeight, int resizeType)
public void resize(int newWidth, int newHeight, int resizeType)
Resizes the image.
Parameters:
Parameter | Type | Description |
---|---|---|
newWidth | int | The new width. |
newHeight | int | The new height. |
resizeType | int | The resize type. |
resize(int newWidth, int newHeight, ImageResizeSettings settings)
public void resize(int newWidth, int newHeight, ImageResizeSettings settings)
Resizes the image.
Parameters:
Parameter | Type | Description |
---|---|---|
newWidth | int | The new width. |
newHeight | int | The new height. |
settings | ImageResizeSettings | The resize settings. |
resizeWidthProportionally(int newWidth, int resizeType)
public void resizeWidthProportionally(int newWidth, int resizeType)
Resizes the width proportionally.
Parameters:
Parameter | Type | Description |
---|---|---|
newWidth | int | The new width. |
resizeType | int | Type of the resize. |
resizeHeightProportionally(int newHeight, int resizeType)
public void resizeHeightProportionally(int newHeight, int resizeType)
Resizes the width proportionally.
Parameters:
Parameter | Type | Description |
---|---|---|
newHeight | int | The new height. |
resizeType | int | Type of the resize. |
replaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)
public void replaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)
Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
Parameters:
Parameter | Type | Description |
---|---|---|
oldColorArgb | int | Old color ARGB value to be replaced. |
oldColorDiff | byte | Allowed difference in old color to be able to widen replaced color tone. |
newColorArgb | int | New color ARGB value to replace old color with. |
replaceNonTransparentColors(int newColorArgb)
public void replaceNonTransparentColors(int newColorArgb)
Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges. Note: if you use it on images without transparency, all colors will be replaced with a single one.
Parameters:
Parameter | Type | Description |
---|---|---|
newColorArgb | int | New color ARGB value to replace non-transparent colors with. |
filter(Rectangle rectangle, FilterOptionsBase options)
public void filter(Rectangle rectangle, FilterOptionsBase options)
Filters the specified rectangle.
Parameters:
Parameter | Type | Description |
---|---|---|
rectangle | Rectangle | The rectangle. |
options | FilterOptionsBase | The options. |
normalizeAngle(boolean resizeProportionally, Color backgroundColor)
public void normalizeAngle(boolean resizeProportionally, Color backgroundColor)
Normalizes the angle. This method is applicable to scanned text documents to get rid of the skewed scan. This method uses RasterImage.getSkewAngle and RasterImage.rotate(float, boolean, Color) methods.
Parameters:
Parameter | Type | Description |
---|---|---|
resizeProportionally | boolean | if set to true you will have your image size changed according to rotated rectangle (corner points) projections in other case that leaves dimensions untouched and only internal image contents are rotated. |
backgroundColor | Color | Color of the background. |
cacheData()
public void cacheData()
Caches the data private.