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

MethodDescription
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:

ParameterTypeDescription
valueColora 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:

ParameterTypeDescription
valueXmpPacketWrapperXMP 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:

ParameterTypeDescription
valuePageExportingActionthe page exporting action.

adjustBrightness(int brightness)

public void adjustBrightness(int brightness)

Adjust of a brightness for image.

Parameters:

ParameterTypeDescription
brightnessintBrightness value.

adjustContrast(float contrast)

public void adjustContrast(float contrast)

Image contrasting

Parameters:

ParameterTypeDescription
contrastfloatContrast 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:

ParameterTypeDescription
gammaRedfloatGamma for red channel coefficient
gammaGreenfloatGamma for green channel coefficient
gammaBluefloatGamma for blue channel coefficient

adjustGamma(float gamma)

public void adjustGamma(float gamma)

Gamma-correction of an image.

Parameters:

ParameterTypeDescription
gammafloatGamma 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:

ParameterTypeDescription
originPointThe background image blending origin.
overlayRasterImageThe overlay image.
overlayAreaRectangleThe overlay area.
overlayAlphabyteThe overlay alpha.

binarizeFixed(byte threshold)

public void binarizeFixed(byte threshold)

Binarization of an image with predefined threshold

Parameters:

ParameterTypeDescription
thresholdbyteThreshold 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:

ParameterTypeDescription
brightnessDifferencedoubleThe brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
windowSizeintThe 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:

ParameterTypeDescription
brightnessDifferencedoubleThe 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:

ParameterTypeDescription
rectangleRectangleThe 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:

ParameterTypeDescription
leftShiftintThe left shift.
rightShiftintThe right shift.
topShiftintThe top shift.
bottomShiftintThe 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:

ParameterTypeDescription
ditheringMethodintThe dithering method.
bitsCountintThe final bits count for dithering.
customPaletteIColorPaletteThe 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:

ParameterTypeDescription
anglefloatThe rotation angle in degrees. Positive values will rotate clockwise.
resizeProportionallybooleanif 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.
backgroundColorColorColor of the background.

rotateFlip(int rotateFlipType)

public void rotateFlip(int rotateFlipType)

Rotates, flips, or rotates and flips all pages.

Parameters:

ParameterTypeDescription
rotateFlipTypeintThe rotation flip type.

rotateFlipAll(int rotateFlip)

public void rotateFlipAll(int rotateFlip)

Rotates the flip all.

Parameters:

ParameterTypeDescription
rotateFlipintThe rotation flip.

resize(int newWidth, int newHeight, int resizeType)

public void resize(int newWidth, int newHeight, int resizeType)

Resizes the image.

Parameters:

ParameterTypeDescription
newWidthintThe new width.
newHeightintThe new height.
resizeTypeintThe resize type.

resize(int newWidth, int newHeight, ImageResizeSettings settings)

public void resize(int newWidth, int newHeight, ImageResizeSettings settings)

Resizes the image.

Parameters:

ParameterTypeDescription
newWidthintThe new width.
newHeightintThe new height.
settingsImageResizeSettingsThe resize settings.

resizeWidthProportionally(int newWidth, int resizeType)

public void resizeWidthProportionally(int newWidth, int resizeType)

Resizes the width proportionally.

Parameters:

ParameterTypeDescription
newWidthintThe new width.
resizeTypeintType of the resize.

resizeHeightProportionally(int newHeight, int resizeType)

public void resizeHeightProportionally(int newHeight, int resizeType)

Resizes the width proportionally.

Parameters:

ParameterTypeDescription
newHeightintThe new height.
resizeTypeintType 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:

ParameterTypeDescription
oldColorArgbintOld color ARGB value to be replaced.
oldColorDiffbyteAllowed difference in old color to be able to widen replaced color tone.
newColorArgbintNew 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:

ParameterTypeDescription
newColorArgbintNew 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:

ParameterTypeDescription
rectangleRectangleThe rectangle.
optionsFilterOptionsBaseThe 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:

ParameterTypeDescription
resizeProportionallybooleanif 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.
backgroundColorColorColor of the background.

cacheData()

public void cacheData()

Caches the data private.