RasterImage Class
Represents a raster image supporting raster graphics operations.
Inheritance Hierarchy

Namespace: Aspose.PSD
Assembly: Aspose.PSD (in Aspose.PSD.dll) Version: 20.11
Syntax
public abstract class RasterImage : Image, 
	IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader

The RasterImage type exposes the following members.

Constructors
  NameDescription
Protected methodRasterImage
Initializes a new instance of the RasterImage class.
Protected methodRasterImage(IColorPalette)
Initializes a new instance of the RasterImage class.
Properties
  NameDescription
Public propertyAutoAdjustPalette
Gets or sets a value indicating whether automatic adjust palette.
(Inherited from Image.)
Public propertyBackgroundColor
Gets or sets a value for the background color.
(Inherited from Image.)
Public propertyBitsPerPixel
Gets the image bits per pixel count.
(Inherited from Image.)
Public propertyBounds
Gets the image bounds.
(Inherited from Image.)
Public propertyBufferSizeHint
Gets or sets the buffer size hint which is defined max allowed size for all internal buffers.
(Inherited from Image.)
Public propertyContainer
Gets the Image container.
(Inherited from Image.)
Protected propertyDataLoader
Gets or sets the data loader.
Public propertyDataStreamContainer
Gets the object's data stream.
(Inherited from DataStreamSupporter.)
Public propertyDisposed
Gets a value indicating whether this instance is disposed.
(Inherited from DisposableObject.)
Public propertyFileFormat
Gets a value of file format
(Inherited from Image.)
Public propertyHasAlpha
Gets a value indicating whether this instance has alpha.
Public propertyHasBackgroundColor
Gets or sets a value indicating whether image has background color.
(Inherited from Image.)
Public propertyHasTransparentColor
Gets a value indicating whether image has transparent color.
Public propertyHeight
Gets the image height.
(Inherited from Image.)
Public propertyHorizontalResolution
Gets or sets the horizontal resolution, in pixels per inch, of this RasterImage.
Public propertyImageOpacity
Gets opacity of this image.
Public propertyInterruptMonitor
Gets or sets the interrupt monitor.
(Inherited from Image.)
Public propertyIsCached
Gets a value indicating whether object's data is cached currently and no data readig is required.
(Inherited from DataStreamSupporter.)
Public propertyIsRawDataAvailable
Gets a value indicating whether raw data loading is available.
Public propertyPalette
Gets or sets the color palette.
(Inherited from Image.)
Public propertyPremultiplyComponents
Gets or sets a value indicating whether the image components must be premultiplied.
Public propertyRawCustomColorConverter
Gets or sets the custom color converter
Public propertyRawDataFormat
Gets the raw data format.
Public propertyRawDataSettings
Gets the current raw data settings. Note when using these settings the data loads without conversion.
Public propertyRawFallbackIndex
Gets or sets the fallback index to use when palette index is out of bounds
Public propertyRawIndexedColorConverter
Gets or sets the indexed color converter
Public propertyRawLineSize
Gets the raw line size in bytes.
Public propertySize
Gets the image size.
(Inherited from Image.)
Public propertyTransparentColor
Gets the image transparent color.
Public propertyUpdateXmpData
Gets or sets a value indicating whether to update the XMP metadata.
Public propertyUseRawData
Gets or sets a value indicating whether to use raw data loading when the raw data loading is available.
Public propertyVerticalResolution
Gets or sets the vertical resolution, in pixels per inch, of this RasterImage.
Public propertyWidth
Gets the image width.
(Inherited from Image.)
Public propertyXmpData
Gets or sets the XMP metadata.
Methods
  NameDescription
Public methodAdjustBrightness
Adjust of a brightness for image.
Public methodAdjustContrast
Image contrasting
Public methodAdjustGamma(Single)
Gamma-correction of an image.
Public methodAdjustGamma(Single, Single, Single)
Gamma-correction of an image.
Public methodBinarizeBradley(Double)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
Public methodBinarizeBradley(Double, Int32)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
Public methodBinarizeFixed
Binarization of an image with predefined threshold
Public methodBinarizeOtsu
Binarization of an image with Otsu thresholding
Public methodCacheData
Caches the data and ensures no additional data loading will be performed from the underlying DataStreamContainer.
(Inherited from DataStreamSupporter.)
Public methodCanSave
Determines whether image can be saved to the specified file format represented by the passed save options.
(Inherited from Image.)
Public methodCode exampleCrop(Rectangle)
Crops the specified rectangle.
Public methodCrop(Int32, Int32, Int32, Int32)
Crop image with shifts.
Public methodDispose
Disposes the current instance.
(Inherited from DisposableObject.)
Public methodDither(DitheringMethod, Int32)
Performs dithering on the current image.
Public methodDither(DitheringMethod, Int32, IColorPalette)
Performs dithering on the current image.
Protected methodDoAfterSave
Does the after save.
(Inherited from DataStreamSupporter.)
Protected methodDoUseRecursion
Gets value indicating whether use recursion for synchronization.
(Overrides ImageDoUseRecursion(ImageImageOperation).)
Public methodEquals (Inherited from Object.)
Public methodFilter
Filters the specified rectangle.
Protected methodFinalize (Inherited from DisposableObject.)
Public methodGetArgb32Pixel
Gets an image 32-bit ARGB pixel.
Protected methodGetCanNotSaveMessage
Gets the can not save message.
(Inherited from Image.)
Public methodGetDefaultArgb32Pixels
Gets the default 32-bit ARGB pixels array.
Public methodGetDefaultOptions
Gets the default options.
(Inherited from Image.)
Public methodGetDefaultPixels
Gets the default pixels array using partial pixel loader.
Public methodGetDefaultRawData(Rectangle, RawDataSettings)
Gets the default raw data array.
Public methodGetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings)
Gets the default raw data array using partial pixel loader.
Protected methodGetFitRectangle(Rectangle)
Gets rectangle which fits the current image.
(Inherited from Image.)
Protected methodGetFitRectangle(Rectangle, Int32)
Gets rectangle which fits the current bitmap taking into account the pixels passed. The passed pixels array count should be equal to the fitting rectangle size.
(Inherited from Image.)
Public methodGetHashCode (Inherited from Object.)
Protected methodGetImage2Export
Gets the image to export.
(Inherited from Image.)
Public methodGetModifyDate
Gets the date and time the resource image was last modified.
Public methodGetOriginalOptions
Gets the options based on the original file settings. This can be helpful to keep bit-depth and other parameters of the original image unchanged. For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the Save(String) method, the output PNG image with 8-bit per pixel will be produced. To avoid it and save PNG image with 1-bit per pixel, use this method to get corresponding saving options and pass them to the Save(String, ImageOptionsBase) method as the second parameter.
(Inherited from Image.)
Public methodGetPixel
Gets an image pixel.
Public methodGetSkewAngle
Gets the skew angle. This method is applicable to scanned text documents, to determine the skew angle when scanning.
Public methodGetType (Inherited from Object.)
Public methodGrayscale
Transformation of an image to its grayscale representation
Public methodLoadArgb32Pixels
Loads 32-bit ARGB pixels.
Public methodLoadArgb64Pixels
Loads 64-bit ARGB pixels.
Public methodLoadCmyk32Pixels
Loads pixels in CMYK format.
Public methodLoadCmykPixels Obsolete.
Loads pixels in CMYK format. This method is deprecated. Please use more effective the LoadCmyk32Pixels(Rectangle) method.
Public methodLoadPartialArgb32Pixels
Loads 32-bit ARGB pixels partially by packs.
Public methodLoadPartialPixels
Loads pixels partially by packs.
Public methodCode exampleLoadPixels
Loads pixels.
Public methodLoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader)
Loads raw data.
Public methodLoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader)
Loads raw data.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodNormalizeAngle
Normalizes the angle. This method is applicable to scanned text documents to get rid of the skewed scan. This method uses GetSkewAngle and Rotate(Single) methods.
Public methodNormalizeAngle(Boolean, Color)
Normalizes the angle. This method is applicable to scanned text documents to get rid of the skewed scan. This method uses GetSkewAngle and Rotate(Single, Boolean, Color) methods.
Protected methodOnDataStreamContainerChanging
Called when data stream container is changing.
(Inherited from DataStreamSupporter.)
Protected methodOnPaletteChanged
Called when palette is changed.
(Inherited from Image.)
Protected methodOnPaletteChanging
Called when palette is changing.
(Inherited from Image.)
Public methodReadArgb32ScanLine
Reads the whole scan line by the specified scan line index.
Public methodReadScanLine
Reads the whole scan line by the specified scan line index.
Protected methodReleaseManagedResources
Releases the managed resources. Make sure no unmanaged resources are released here, since they may have been already released.
(Overrides ImageReleaseManagedResources.)
Protected methodReleaseUnmanagedResources
Releases the unmanaged resources. Make sure no managed resources are released here, since they may have been already released.
(Inherited from DisposableObject.)
Public methodReplaceColor(Int32, Byte, Int32)
Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
Public methodReplaceColor(Color, Byte, Color)
Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
Public methodReplaceNonTransparentColors(Int32)
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.
Public methodReplaceNonTransparentColors(Color)
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.
Public methodCode exampleResize(Int32, Int32)
Resizes the image. The default LeftTopToLeftTop is used.
(Inherited from Image.)
Public methodResize(Int32, Int32, ImageResizeSettings)
Resizes the image with extended options.
(Overrides ImageResize(Int32, Int32, ImageResizeSettings).)
Public methodResize(Int32, Int32, ResizeType)
Resizes the image.
(Overrides ImageResize(Int32, Int32, ResizeType).)
Public methodResizeHeightProportionally(Int32)
Resizes the height proportionally.
(Inherited from Image.)
Public methodResizeHeightProportionally(Int32, ImageResizeSettings)
Resizes the height proportionally.
(Inherited from Image.)
Public methodResizeHeightProportionally(Int32, ResizeType)
Resizes the height proportionally.
(Inherited from Image.)
Public methodResizeWidthProportionally(Int32)
Resizes the width proportionally.
(Inherited from Image.)
Public methodResizeWidthProportionally(Int32, ImageResizeSettings)
Resizes the width proportionally.
(Inherited from Image.)
Public methodResizeWidthProportionally(Int32, ResizeType)
Resizes the width proportionally.
(Inherited from Image.)
Public methodRotate(Single)
Rotate image around the center.
Public methodRotate(Single, Boolean, Color)
Rotate image around the center.
Public methodCode exampleRotateFlip
Rotates, flips, or rotates and flips the image.
(Inherited from Image.)
Public methodSave
Saves the image data to the underlying stream.
(Inherited from Image.)
Public methodSave(Stream)
Saves the object's data to the specified stream.
(Inherited from DataStreamSupporter.)
Public methodSave(String)
Saves the object's data to the specified file location.
(Inherited from DataStreamSupporter.)
Public methodSave(String, Boolean)
Saves the object's data to the specified file location.
(Inherited from DataStreamSupporter.)
Public methodCode exampleSave(Stream, ImageOptionsBase)
Saves the image's data to the specified stream in the specified file format according to save options.
(Inherited from Image.)
Public methodCode exampleSave(String, ImageOptionsBase)
Saves the object's data to the specified file location in the specified file format according to save options.
(Inherited from Image.)
Public methodSave(Stream, ImageOptionsBase, Rectangle)
Saves the image's data to the specified stream in the specified file format according to save options.
(Inherited from Image.)
Public methodSave(String, ImageOptionsBase, Rectangle)
Saves the object's data to the specified file location in the specified file format according to save options.
(Inherited from Image.)
Public methodSaveArgb32Pixels
Saves the 32-bit ARGB pixels.
Public methodSaveCmyk32Pixels
Saves the pixels.
Public methodSaveCmykPixels Obsolete.
Protected methodSaveData
Saves the data.
(Inherited from DataStreamSupporter.)
Public methodCode exampleSavePixels
Saves the pixels.
Protected methodSavePixelsInternal
Saves pixels (format specific method).
Public methodSaveRawData
Saves the raw data.
Public methodSetArgb32Pixel
Sets an image 32-bit ARGB pixel for the specified position.
Public methodSetPalette
Sets the image palette.
(Overrides ImageSetPalette(IColorPalette, Boolean).)
Public methodSetPixel
Sets an image pixel for the specified position.
Public methodSetResolution
Sets the resolution for this RasterImage.
Public methodToBitmap
Converts raster image to the bitmap.
Public methodToString (Inherited from Object.)
Protected methodUpdateMetadata
Updates the image metadata.
Protected methodVerifyNotDisposed
Verifies that the current instance is not disposed.
(Inherited from DisposableObject.)
Public methodWriteArgb32ScanLine
Writes the whole scan line to the specified scan line index.
Public methodWriteScanLine
Writes the whole scan line to the specified scan line index.
Fields
  NameDescription
Protected fieldTimeout
The timeout to wait for synchronization
(Inherited from DataStreamSupporter.)
Protected fieldxmpData
The XMP metadata
Examples
This example shows how to Loads Pixel information in an Array of Type Color, manipulates the array and set it back to the image. To perform these operations, this example creates a new Image file (in PSD format) using MemoryStream object.
[C#]

//Create an instance of MemoryStream
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
    //Create an instance of PsdOptions and set its various properties including the Source property
    Aspose.PSD.ImageOptions.PsdOptions psdOptions = new Aspose.PSD.ImageOptions.PsdOptions();
    psdOptions.Source = new Aspose.PSD.Sources.StreamSource(stream);

    //Create an instance of Image
    using (Aspose.PSD.RasterImage image = (Aspose.PSD.RasterImage)Aspose.PSD.Image.Create(psdOptions, 500, 500))
    {
        //Get the pixels of image by specifying the area as image boundary
        Aspose.PSD.Color[] pixels = image.LoadPixels(image.Bounds);

        //Loop over the Array and sets color of alrenative indexed pixel
        for (int index = 0; index < pixels.Length; index++)
        {
            if (index % 2 == 0)
            {
                //Set the indexed pixel color to yellow
                pixels[index] = Aspose.PSD.Color.Yellow;
            }
            else
            {
                //Set the indexed pixel color to blue
                pixels[index] = Aspose.PSD.Color.Blue;
            }
        }

        //Apply the pixel changes to the image
        image.SavePixels(image.Bounds, pixels);

        // save all changes.
        image.Save();
    }

    //Write MemoryStream to File
    stream.WriteTo(new System.IO.FileStream(@"C:\temp\output.psd", System.IO.FileMode.CreateNew));
}
See Also