Packages

 

com.aspose.imaging

Interfaces

Classes

Exceptions

com.aspose.imaging

Class RasterCachedMultipageImage

  • All Implemented Interfaces:
    IMultipageImage, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, com.aspose.imaging_internal.IPixelsSaver, com.aspose.imaging_internal.progressmanagement.IProgressEventHandler, com.aspose.imaging_internal.progressmanagement.IProgressInformer, com.aspose.ms.System.IDisposable, Closeable, AutoCloseable
    Direct Known Subclasses:
    DicomImage, DjvuImage, GifImage, TiffImage, WebPImage


    public abstract class RasterCachedMultipageImage
    extends RasterCachedImage
    implements IMultipageImage

    The raster multipage image

    <autogeneratedoc></autogeneratedoc>
    Code 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. */
    }
    

    • Method Detail

      • getHeight

        public int getHeight()

        Gets the image height.

        Value: The image height.
        Specified by:
        getHeight in interface IObjectWithBounds
        Specified by:
        getHeight in class Image
        Returns:
        the image height.
      • getWidth

        public int getWidth()

        Gets the image width.

        Value: The image width.
        Specified by:
        getWidth in interface IObjectWithBounds
        Specified by:
        getWidth in class Image
        Returns:
        the image width.
      • getBitsPerPixel

        public int getBitsPerPixel()

        Gets the image bits per pixel count.

        Value: The image bits per pixel count. <autogeneratedoc></autogeneratedoc>
        Specified by:
        getBitsPerPixel in class Image
        Returns:
        the image bits per pixel count.
      • isCached

        public final boolean isCached()

        Gets a value indicating whether image data is cached currently.

        Value: true if image data is cached; otherwise, false.
        Overrides:
        isCached in class RasterCachedImage
        Returns:
        a value indicating whether image data is cached currently.
      • getPageCount

        public abstract int getPageCount()

        Gets the page count.

        Value: The page count. <autogeneratedoc></autogeneratedoc>
        Specified by:
        getPageCount in interface IMultipageImage
        Returns:
        the page count.
      • getPages

        public abstract Image[] getPages()

        Gets the pages.

        Value: The pages. <autogeneratedoc></autogeneratedoc>
        Specified by:
        getPages in interface IMultipageImage
        Returns:
        the pages.
      • getDefaultPage

        public abstract Image getDefaultPage()

        Gets the default page.

        Value: The default page. <autogeneratedoc></autogeneratedoc>
        Specified by:
        getDefaultPage in interface IMultipageImage
        Returns:
        the default page.
      • hasAlpha

        public boolean hasAlpha()

        Gets a value indicating whether this instance has alpha.

        Value: true if this instance has alpha; otherwise, false.
        Overrides:
        hasAlpha in class RasterImage
        Returns:
        a value indicating whether this instance has alpha.
      • hasTransparentColor

        public boolean hasTransparentColor()

        Gets a value indicating whether image has transparent color.

        Overrides:
        hasTransparentColor in class RasterImage
        Returns:
        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). <autogeneratedoc></autogeneratedoc>
        Overrides:
        getImageOpacity in class RasterImage
        Returns:
        opacity of this image.
      • getBackgroundColor

        public Color getBackgroundColor()

        Gets a value for the background color.

        Overrides:
        getBackgroundColor in class Image
        Returns:
        a value for the background color.
      • setBackgroundColor

        public void setBackgroundColor(Color value)

        Sets a value for the background color.

        Overrides:
        setBackgroundColor in class Image
        Parameters:
        value - a value for the background color.
      • setXmpData

        public void setXmpData(XmpPacketWrapper value)

        Sets XMP data from frame.

        Value: XMP packet data wrapper
        Overrides:
        setXmpData in class RasterImage
        Parameters:
        value - 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.
        Specified by:
        getPageExportingAction in interface IMultipageImage
        Returns:
        the page exporting action.
      • setPageExportingAction

        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.
        Specified by:
        setPageExportingAction in interface IMultipageImage
        Parameters:
        value - the page exporting action.
      • adjustBrightness

        public void adjustBrightness(int brightness)

        Adjust of a brightness for image.

        Overrides:
        adjustBrightness in class RasterCachedImage
        Parameters:
        brightness - Brightness value.
      • adjustContrast

        public void adjustContrast(float contrast)

        Image contrasting

        Overrides:
        adjustContrast in class RasterCachedImage
        Parameters:
        contrast - Contrast value (in range [-100; 100])
      • adjustGamma

        public void adjustGamma(float gammaRed,
                                float gammaGreen,
                                float gammaBlue)

        Gamma-correction of an image.

        Overrides:
        adjustGamma in class RasterCachedImage
        Parameters:
        gammaRed - Gamma for red channel coefficient
        gammaGreen - Gamma for green channel coefficient
        gammaBlue - Gamma for blue channel coefficient
      • adjustGamma

        public void adjustGamma(float gamma)

        Gamma-correction of an image.

        Overrides:
        adjustGamma in class RasterCachedImage
        Parameters:
        gamma - Gamma for red, green and blue channels coefficient
      • binarizeFixed

        public void binarizeFixed(byte threshold)

        Binarization of an image with predefined threshold

        Overrides:
        binarizeFixed in class RasterCachedImage
        Parameters:
        threshold - 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

        public void binarizeBradley(double brightnessDifference,
                                    int windowSize)

        Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding

        Overrides:
        binarizeBradley in class RasterCachedImage
        Parameters:
        brightnessDifference - The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
        windowSize - The size of s x s window of pixels centered around this pixel
      • binarizeBradley

        public void binarizeBradley(double brightnessDifference)

        Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding

        Overrides:
        binarizeBradley in class RasterCachedImage
        Parameters:
        brightnessDifference - The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
      • crop

        public void crop(Rectangle rectangle)

        Cropping the image.

        Overrides:
        crop in class RasterCachedImage
        Parameters:
        rectangle - The rectangle.
      • crop

        public void crop(int leftShift,
                         int rightShift,
                         int topShift,
                         int bottomShift)

        Crop image with shifts.

        Overrides:
        crop in class RasterImage
        Parameters:
        leftShift - The left shift.
        rightShift - The right shift.
        topShift - The top shift.
        bottomShift - The bottom shift.
        Throws:
        com.aspose.ms.System.ArgumentException - Rectangle incorrect. - rectangle or Rectangle must be contained in the image bounds. - rectangle
        ImageException - Can't crop image. Frame index: " + frameIndex or Can't crop image.
      • dither

        public void dither(int ditheringMethod,
                           int bitsCount,
                           IColorPalette customPalette)

        Performs dithering on the current image.

        Overrides:
        dither in class RasterCachedImage
        Parameters:
        ditheringMethod - The dithering method.
        bitsCount - The final bits count for dithering.
        customPalette - The custom palette for dithering.
      • grayscale

        public void grayscale()

        Transformation of an image to its grayscale representation

        Overrides:
        grayscale in class RasterCachedImage
      • rotate

        public void rotate(float angle,
                           boolean resizeProportionally,
                           Color backgroundColor)

        RasterCahcedMultipageImage.Rotate image around the center.

        Overrides:
        rotate in class RasterCachedImage
        Parameters:
        angle - The rotate angle in degrees. Positive values will rotate clockwise.
        resizeProportionally - 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 of the background.
      • rotateFlip

        public void rotateFlip(int rotateFlipType)

        Rotates, flips, or rotates and flips the Active frame only.

        Overrides:
        rotateFlip in class RasterCachedImage
        Parameters:
        rotateFlipType - The rotate flip type.
        See Also:
        RotateFlipType
      • rotateFlipAll

        public void rotateFlipAll(int rotateFlip)

        Rotates the flip all.

        Parameters:
        rotateFlip - The rotate flip. <autogeneratedoc></autogeneratedoc>
      • resize

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

        Resizes the image.

        Overrides:
        resize in class RasterCachedImage
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        resizeType - The resize type.
      • resize

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

        Resizes the image.

        Overrides:
        resize in class RasterCachedImage
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        settings - The resize settings.
      • resizeWidthProportionally

        public void resizeWidthProportionally(int newWidth,
                                              int resizeType)

        Resizes the width proportionally.

        Overrides:
        resizeWidthProportionally in class Image
        Parameters:
        newWidth - The new width.
        resizeType - Type of the resize.
      • resizeHeightProportionally

        public void resizeHeightProportionally(int newHeight,
                                               int resizeType)

        Resizes the width proportionally.

        Overrides:
        resizeHeightProportionally in class Image
        Parameters:
        newHeight - The new height.
        resizeType - Type of the resize.
      • replaceColor

        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.

        Overrides:
        replaceColor in class RasterImage
        Parameters:
        oldColorArgb - Old color ARGB value to be replaced.
        oldColorDiff - Allowed difference in old color to be able to widen replaced color tone.
        newColorArgb - New color ARGB value to replace old color with.
      • replaceNonTransparentColors

        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.

        Overrides:
        replaceNonTransparentColors in class RasterImage
        Parameters:
        newColorArgb - New color ARGB value to replace non transparent colors with.
      • filter

        public void filter(Rectangle rectangle,
                           FilterOptionsBase options)

        Filters the specified rectangle.

        Overrides:
        filter in class RasterImage
        Parameters:
        rectangle - The rectangle.
        options - The options.
      • normalizeAngle

        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.

        Overrides:
        normalizeAngle in class RasterImage
        Parameters:
        resizeProportionally - 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 of the background.