Packages

 

com.aspose.imaging.fileformats.djvu

Class DjvuImage

    • Field Detail

      • PropertyChanged

        public final com.aspose.ms.lang.Event<com.aspose.ms.System.ComponentModel.PropertyChangedEventHandler> PropertyChanged
    • Constructor Detail

      • DjvuImage

        public DjvuImage(InputStream stream)

        Initializes a new instance of the DjvuImage class.

        Parameters:
        stream - The stream.
        Throws:
        DjvuImageException - Stream is empty
      • DjvuImage

        public DjvuImage(InputStream stream,
                         LoadOptions loadOptions)

        Initializes a new instance of the DjvuImage class.

        Parameters:
        stream - The stream to load from.
        loadOptions - The load options.
        Throws:
        DjvuImageException - Stream is empty
      • DjvuImage

        public DjvuImage(com.aspose.ms.System.IO.Stream stream,
                         LoadOptions loadOptions)
    • Method Detail

      • getIdentifier

        public int getIdentifier()

        Gets the unique identifier for the document

        Returns:
        The identifier.
      • getPages

        public DjvuPage[] getPages()

        Gets the pages for the document

        Returns:
        The pages.
      • getActivePage

        public DjvuPage getActivePage()

        Gets or sets the currently active page

        Returns:
        The active page.
        Throws:
        DjvuImageException - There is no active page selected.
      • setActivePage

        public void setActivePage(DjvuPage value)

        Gets or sets the currently active page

        Parameters:
        value - The active page.
        Throws:
        DjvuImageException - When the active page cannot be set as it belongs to another image.
      • getFirstPage

        public DjvuPage getFirstPage()

        Gets the first page of the document

        Returns:
        The first page.
        Throws:
        DjvuImageException - The first page can not be found
      • getLastPage

        public DjvuPage getLastPage()

        Gets the last page of the document

        Returns:
        The last page.
        Throws:
        DjvuImageException - The last page can not be found
      • getNextPage

        public DjvuPage getNextPage()

        Gets the next page of the document

        Returns:
        The next page.
        Throws:
        DjvuImageException - The next page can not be found
      • getPreviousPage

        public DjvuPage getPreviousPage()

        Gets the previous page of the document

        Returns:
        The previous page.
        Throws:
        DjvuImageException - The previous page can not be found
      • getBitsPerPixel

        public int getBitsPerPixel()

        Gets the image bits per pixel count.

        Specified by:
        getBitsPerPixel in class Image
        Returns:
        The image bits per pixel count.
      • isCached

        public final boolean isCached()

        Gets a value indicating whether object's data is cached currently and no data readig is required.

        Specified by:
        isCached in class DataStreamSupporter
        Returns:
        true if object's data is cached; otherwise, false.
      • getImageOpacity

        public float getImageOpacity()

        Gets opacity of this image. 0 = fully transparent, 1 = fully opaque.

        Overrides:
        getImageOpacity in class RasterImage
        Returns:
        The opacity value between 0.0 (fully transparent) and 1.0 (fully opaque).
      • getFileFormat

        public long getFileFormat()

        Gets a value of file format

        Overrides:
        getFileFormat in class Image
      • loadDocument

        public static DjvuImage loadDocument(InputStream stream)

        Loads the document.

        Parameters:
        stream - The stream.
        Returns:
        Loaded djvu document
      • loadDocument

        public static DjvuImage loadDocument(InputStream stream,
                                             LoadOptions loadOptions)

        Loads the document.

        Parameters:
        stream - The stream.
        loadOptions - The load options.
        Returns:
        Loaded djvu document
      • resize

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

        Resizes the image.

        Overrides:
        resize in class RasterImage
        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 with extended options.

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

        public void resizeHeightProportionally(int newHeight,
                                               int resizeType)

        Resizes the height proportionally.

        Overrides:
        resizeHeightProportionally in class Image
        Parameters:
        newHeight - The new height.
        resizeType - Type of the resize.
      • 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.
      • crop

        public void crop(Rectangle rectangle)

        Cropping the image.

        Overrides:
        crop in class RasterImage
        Parameters:
        rectangle - The rectangle.
      • rotateFlip

        public void rotateFlip(int rotateFlipType)

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

        Specified by:
        rotateFlip in class Image
        Parameters:
        rotateFlipType - The rotate flip type.
      • grayscale

        public void grayscale()

        Transformation of an image to its grayscale representation

        Overrides:
        grayscale in class RasterImage
      • binarizeFixed

        public void binarizeFixed(byte threshold)

        Binarization of an image with predefined threshold

        Overrides:
        binarizeFixed in class RasterImage
        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.
      • binarizeOtsu

        public void binarizeOtsu()

        Binarization of an image with Otsu thresholding

        Overrides:
        binarizeOtsu in class RasterImage
      • 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 RasterImage
        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 RasterImage
        Parameters:
        brightnessDifference - The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
      • adjustBrightness

        public void adjustBrightness(int brightness)

        Adjust of a brightness for image.

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

        public void adjustContrast(float contrast)

        Image contrasting

        Overrides:
        adjustContrast in class RasterImage
        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 RasterImage
        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 RasterImage
        Parameters:
        gamma - Gamma for red, green and blue channels coefficient
      • rotateFlipAll

        public void rotateFlipAll(int rotateFlip)

        Rotates the flip all frames in image.

        Parameters:
        rotateFlip - The rotate flip type.
      • rotate

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

        Rotate image around the center.

        Overrides:
        rotate in class RasterImage
        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 internal image contents are rotated.
        backgroundColor - Color of the background.
      • cacheData

        public final void cacheData()

        Caches the data and ensures no additional data loading will be performed from the underlying DataStreamSupporter.DataStreamContainer.

        Specified by:
        cacheData in class DataStreamSupporter
      • dither

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

        Performs dithering on the current image.

        Specified by:
        dither in class RasterImage
        Parameters:
        ditheringMethod - The dithering method.
        bitsCount - The final bits count for dithering.
        customPalette - The custom palette for dithering.
      • filter

        public void filter(Rectangle rectangle,
                           FilterOptionsBase options)

        Filters the specified rectangle.

        Overrides:
        filter in class RasterImage
        Parameters:
        rectangle - The rectangle.
        options - The options.
      • 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.