Class RasterCachedMultipageImage
Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.2.0)
The raster multipage image
public abstract class RasterCachedMultipageImage : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata, IMultipageImage
Inheritance
object ← DisposableObject ← DataStreamSupporter ← Image ← RasterImage ← RasterCachedImage ← RasterCachedMultipageImage
Derived
ApngImage, DicomImage, DjvuImage, GifImage, IcoImage, TiffImage, WebPImage
Implements
IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata, IMultipageImage
Inherited Members
RasterCachedImage.CacheData(), RasterCachedImage.Blend(Point, RasterImage, Rectangle, byte), RasterCachedImage.Resize(int, int, ResizeType), RasterCachedImage.Resize(int, int, ImageResizeSettings), RasterCachedImage.RotateFlip(RotateFlipType), RasterCachedImage.Rotate(float, bool, Color), RasterCachedImage.Crop(Rectangle), RasterCachedImage.Dither(DitheringMethod, int, IColorPalette), RasterCachedImage.Grayscale(), RasterCachedImage.BinarizeFixed(byte), RasterCachedImage.BinarizeOtsu(), RasterCachedImage.BinarizeBradley(double, int), RasterCachedImage.BinarizeBradley(double), RasterCachedImage.AdjustBrightness(int), RasterCachedImage.AdjustContrast(float), RasterCachedImage.AdjustGamma(float, float, float), RasterCachedImage.AdjustGamma(float), RasterCachedImage.OnCached(), RasterCachedImage.OnPaletteChanged(IColorPalette, IColorPalette), RasterCachedImage.IsCached, RasterImage.xmpData, RasterImage.RemoveMetadata(), RasterImage.Save(Stream, ImageOptionsBase, Rectangle), RasterImage.GetModifyDate(bool), RasterImage.Dither(DitheringMethod, int), RasterImage.Dither(DitheringMethod, int, IColorPalette), RasterImage.GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader), RasterImage.GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings), RasterImage.GetDefaultArgb32Pixels(Rectangle), RasterImage.GetDefaultRawData(Rectangle, RawDataSettings), RasterImage.GetArgb32Pixel(int, int), RasterImage.GetPixel(int, int), RasterImage.SetArgb32Pixel(int, int, int), RasterImage.SetPixel(int, int, Color), RasterImage.ReadScanLine(int), RasterImage.ReadArgb32ScanLine(int), RasterImage.WriteScanLine(int, Color[]), RasterImage.WriteArgb32ScanLine(int, int[]), RasterImage.LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader), RasterImage.LoadPartialPixels(Rectangle, IPartialPixelLoader), RasterImage.LoadArgb32Pixels(Rectangle), RasterImage.LoadArgb64Pixels(Rectangle), RasterImage.LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader), RasterImage.LoadPixels(Rectangle), RasterImage.LoadCmykPixels(Rectangle), RasterImage.LoadCmyk32Pixels(Rectangle), RasterImage.LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader), RasterImage.LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader), RasterImage.SaveRawData(byte[], int, Rectangle, RawDataSettings), RasterImage.SaveArgb32Pixels(Rectangle, int[]), RasterImage.SavePixels(Rectangle, Color[]), RasterImage.SaveCmykPixels(Rectangle, CmykColor[]), RasterImage.SaveCmyk32Pixels(Rectangle, int[]), RasterImage.SetResolution(double, double), RasterImage.SetPalette(IColorPalette, bool), RasterImage.Resize(int, int, ImageResizeSettings), RasterImage.Rotate(float, bool, Color), RasterImage.Rotate(float), RasterImage.BinarizeFixed(byte), RasterImage.BinarizeOtsu(), RasterImage.BinarizeBradley(double), RasterImage.BinarizeBradley(double, int), RasterImage.Blend(Point, RasterImage, Rectangle, byte), RasterImage.Blend(Point, RasterImage, byte), RasterImage.Grayscale(), RasterImage.AdjustBrightness(int), RasterImage.AdjustContrast(float), RasterImage.AdjustGamma(float, float, float), RasterImage.AdjustGamma(float), RasterImage.GetSkewAngle(), RasterImage.NormalizeAngle(), RasterImage.NormalizeAngle(bool, Color), RasterImage.Filter(Rectangle, FilterOptionsBase), RasterImage.ReplaceColor(Color, byte, Color), RasterImage.ReplaceColor(int, byte, int), RasterImage.ReplaceNonTransparentColors(Color), RasterImage.ReplaceNonTransparentColors(int), RasterImage.ToBitmap(), RasterImage.ReleaseManagedResources(), RasterImage.UpdateMetadata(), RasterImage.UpdateDimensions(int, int), RasterImage.PremultiplyComponents, RasterImage.UseRawData, RasterImage.UpdateXmpData, RasterImage.XmpData, RasterImage.RawIndexedColorConverter, RasterImage.RawCustomColorConverter, RasterImage.RawFallbackIndex, RasterImage.RawDataSettings, RasterImage.UsePalette, RasterImage.RawDataFormat, RasterImage.RawLineSize, RasterImage.IsRawDataAvailable, RasterImage.HorizontalResolution, RasterImage.VerticalResolution, RasterImage.HasTransparentColor, RasterImage.HasAlpha, RasterImage.TransparentColor, RasterImage.ImageOpacity, RasterImage.DataLoader, Image.CanLoad(string), Image.CanLoad(string, LoadOptions), Image.CanLoad(Stream), Image.CanLoad(Stream, LoadOptions), Image.Create(ImageOptionsBase, int, int), Image.Create(Image[]), Image.Create(MultipageCreateOptions), Image.Create(string[], bool), Image.Create(string[]), Image.Create(Image[], bool), Image.GetFileFormat(string), Image.GetFileFormat(Stream), Image.GetFittingRectangle(Rectangle, int, int), Image.GetFittingRectangle(Rectangle, int[], int, int), Image.Load(string, LoadOptions), Image.Load(string), Image.Load(Stream, LoadOptions), Image.Load(Stream), Image.GetProportionalWidth(int, int, int), Image.GetProportionalHeight(int, int, int), Image.RemoveMetadata(), Image.CanSave(ImageOptionsBase), Image.Resize(int, int), Image.Resize(int, int, ResizeType), Image.Resize(int, int, ImageResizeSettings), Image.GetDefaultOptions(object[]), Image.GetOriginalOptions(), Image.ResizeWidthProportionally(int), Image.ResizeHeightProportionally(int), Image.ResizeWidthProportionally(int, ResizeType), Image.ResizeHeightProportionally(int, ResizeType), Image.ResizeWidthProportionally(int, ImageResizeSettings), Image.ResizeHeightProportionally(int, ImageResizeSettings), Image.RotateFlip(RotateFlipType), Image.Rotate(float), Image.Crop(Rectangle), Image.Crop(int, int, int, int), Image.Save(), Image.Save(string), Image.Save(string, ImageOptionsBase), Image.Save(string, ImageOptionsBase, Rectangle), Image.Save(Stream, ImageOptionsBase), Image.Save(Stream, ImageOptionsBase, Rectangle), Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int), Image.SetPalette(IColorPalette, bool), Image.UpdateContainer(Image), Image.GetCanNotSaveMessage(ImageOptionsBase), Image.GetFitRectangle(Rectangle), Image.GetImage2Export(ImageOptionsBase, Rectangle, IImageExporter), Image.GetFitRectangle(Rectangle, int[]), Image.OnPaletteChanged(IColorPalette, IColorPalette), Image.OnPaletteChanging(IColorPalette, IColorPalette), Image.ReleaseManagedResources(), Image.BitsPerPixel, Image.Bounds, Image.Container, Image.Height, Image.Palette, Image.UsePalette, Image.Size, Image.Width, Image.InterruptMonitor, Image.BufferSizeHint, Image.AutoAdjustPalette, Image.HasBackgroundColor, Image.FileFormat, Image.BackgroundColor, DataStreamSupporter.timeout, DataStreamSupporter.CacheData(), DataStreamSupporter.Save(), DataStreamSupporter.Save(Stream), DataStreamSupporter.Save(string), DataStreamSupporter.Save(string, bool), DataStreamSupporter.SaveData(Stream), DataStreamSupporter.ReleaseManagedResources(), DataStreamSupporter.OnDataStreamContainerChanging(StreamContainer), DataStreamSupporter.DataStreamContainer, DataStreamSupporter.IsCached, DisposableObject.Dispose(), DisposableObject.ReleaseManagedResources(), DisposableObject.ReleaseUnmanagedResources(), DisposableObject.VerifyNotDisposed(), DisposableObject.Disposed, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
RasterCachedMultipageImage(IColorPalette)
Initializes a new instance of the Aspose.Imaging.RasterCachedMultipageImage class.
protected RasterCachedMultipageImage(IColorPalette colorPalette)
Parameters
colorPalette
IColorPalette
The color palette.
RasterCachedMultipageImage()
Initializes a new instance of the Aspose.Imaging.RasterCachedMultipageImage class.
protected RasterCachedMultipageImage()
Properties
BackgroundColor
Gets or sets a value for the background color.
public override Color BackgroundColor { get; set; }
Property Value
BitsPerPixel
Gets the image bits per pixel count.
public override int BitsPerPixel { get; }
Property Value
HasAlpha
Gets a value indicating whether this instance has alpha.
public override bool HasAlpha { get; }
Property Value
HasTransparentColor
Gets a value indicating whether image has transparent color.
public override bool HasTransparentColor { get; }
Property Value
Height
Gets the image height.
public override int Height { get; }
Property Value
ImageOpacity
Gets opacity of this image.
public override float ImageOpacity { get; }
Property Value
IsCached
Gets a value indicating whether image data is cached currently.
public override bool IsCached { get; }
Property Value
PageCount
Gets the page count.
public abstract int PageCount { get; }
Property Value
PageExportingAction
Gets or 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.
public virtual PageExportingAction PageExportingAction { get; set; }
Property Value
Examples
The following example shows batch conversion before saving (exporting) Tiff images.```csharp [C#]
string fileName = "10MB_Tif.tif";
string inputFileName = fileName;
string outputFileNameTif = "output.tif";
//The possibility of batch conversion before saving (exporting) Tiff images is implemented.
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(inputFileName))
{
// Set batch operation for pages
tiffImage.PageExportingAction = delegate(int index, Image page)
{
// Fires garbage collection to avoid unnecessary garbage storage from previous pages
GC.Collect();
((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. */
}
### <a id="Aspose_Imaging_RasterCachedMultipageImage_Pages"></a> Pages
Gets the pages.
```csharp
public abstract Image[] Pages { get; }
Property Value
Image[]
Width
Gets the image width.
public override int Width { get; }
Property Value
XmpData
Gets or sets XMP data from frame.
public override XmpPacketWrapper XmpData { get; set; }
Property Value
Methods
AdjustBrightness(int)
Adjust of a brightness
for image.
public override void AdjustBrightness(int brightness)
Parameters
brightness
int
Brightness value.
AdjustContrast(float)
Aspose.Imaging.Image contrasting
public override void AdjustContrast(float contrast)
Parameters
contrast
float
Contrast value (in range [-100; 100])
AdjustGamma(float, float, float)
Gamma-correction of an image.
public override void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Parameters
gammaRed
float
Gamma for red channel coefficient
gammaGreen
float
Gamma for green channel coefficient
gammaBlue
float
Gamma for blue channel coefficient
AdjustGamma(float)
Gamma-correction of an image.
public override void AdjustGamma(float gamma)
Parameters
gamma
float
Gamma for red, green and blue channels coefficient
BinarizeBradley(double, int)
Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding
public override void BinarizeBradley(double brightnessDifference, int windowSize)
Parameters
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)
Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding
public override void BinarizeBradley(double brightnessDifference)
Parameters
brightnessDifference
double
The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
BinarizeFixed(byte)
Binarization of an image with predefined threshold
public override void BinarizeFixed(byte threshold)
Parameters
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.
BinarizeOtsu()
Binarization of an image with Otsu thresholding
public override void BinarizeOtsu()
Blend(Point, RasterImage, Rectangle, byte)
Blends this image instance with the overlay
image.
public override void Blend(Point origin, RasterImage overlay, Rectangle overlayArea, byte overlayAlpha = 255)
Parameters
origin
Point
The background image blending origin.
overlay
RasterImage
The overlay image.
overlayArea
Rectangle
The overlay area.
overlayAlpha
byte
The overlay alpha.
Exceptions
Image exception
CacheData()
Caches the data private.
public override void CacheData()
CanDoAdjustments()
Determines whether this instance [can do adjustments].
protected virtual bool CanDoAdjustments()
Returns
true
if this instance [can do adjustments]; otherwise, false
.
Crop(Rectangle)
Cropping the image.
public override void Crop(Rectangle rectangle)
Parameters
rectangle
Rectangle
The rectangle.
Crop(int, int, int, int)
Crop image with shifts.
public override void Crop(int leftShift, int rightShift, int topShift, int bottomShift)
Parameters
leftShift
int
The left shift.
rightShift
int
The right shift.
topShift
int
The top shift.
bottomShift
int
The bottom shift.
Exceptions
Rectangle incorrect. - rectangle or Rectangle must be contained in the image bounds. - rectangle
Can’t crop image. Frame index: " + frameIndex or Can’t crop image.
CropMain(int, int, int, int)
Crops the main.
protected virtual void CropMain(int leftShift, int rightShift, int topShift, int bottomShift)
Parameters
leftShift
int
The left shift.
rightShift
int
The right shift.
topShift
int
The top shift.
bottomShift
int
The bottom shift.
Dither(DitheringMethod, int, IColorPalette)
Performs dithering on the current image.
public override void Dither(DitheringMethod ditheringMethod, int bitsCount, IColorPalette customPalette)
Parameters
ditheringMethod
DitheringMethod
The dithering method.
bitsCount
int
The final bits count for dithering.
customPalette
IColorPalette
The custom palette for dithering.
Filter(Rectangle, FilterOptionsBase)
Filters the specified rectangle.
public override void Filter(Rectangle rectangle, FilterOptionsBase options)
Parameters
rectangle
Rectangle
The rectangle.
options
FilterOptionsBase
The options.
GetPagesAsEnumerable()
Gets the pages as enumerable.
protected virtual IEnumerable<image/> GetPagesAsEnumerable()
Returns
IEnumerable<Image>
The own pages as enumerable.
GetSerializedStream(ImageOptionsBase, Rectangle, out int)
Converts to aps.
public override Stream GetSerializedStream(ImageOptionsBase imageOptions, Rectangle clippingRectangle, out int pageNumber)
Parameters
imageOptions
ImageOptionsBase
The image options.
clippingRectangle
Rectangle
The clipping rectangle.
pageNumber
int
The page number.
Returns
The serialized stream
Grayscale()
Transformation of an image to its grayscale representation
public override void Grayscale()
NormalizeAngle(bool, Color)
Normalizes the angle. This method is applicable to scanned text documents to get rid of the skewed scan. This method uses Aspose.Imaging.RasterImage.GetSkewAngle and Aspose.Imaging.RasterCachedMultipageImage.Rotate(System.Single,System.Boolean,Aspose.Imaging.Color) methods.
public override void NormalizeAngle(bool resizeProportionally, Color backgroundColor)
Parameters
resizeProportionally
bool
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.
ReleaseManagedResources()
Releases the managed resources. Make sure no unmanaged resources are released here, since they may have been already released.
protected override void ReleaseManagedResources()
ReplaceColor(int, byte, int)
Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
public override void ReplaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)
Parameters
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)
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 override void ReplaceNonTransparentColors(int newColorArgb)
Parameters
newColorArgb
int
New color ARGB value to replace non transparent colors with.
Resize(int, int, ResizeType)
Resizes the image.
public override void Resize(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
int
The new width.
newHeight
int
The new height.
resizeType
ResizeType
The resize type.
Resize(int, int, ImageResizeSettings)
Resizes the image.
public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)
Parameters
newWidth
int
The new width.
newHeight
int
The new height.
settings
ImageResizeSettings
The resize settings.
ResizeHeightProportionally(int, ResizeType)
Resizes the width proportionally.
public override void ResizeHeightProportionally(int newHeight, ResizeType resizeType)
Parameters
newHeight
int
The new height.
resizeType
ResizeType
Type of the resize.
ResizeMain(int, int, ResizeType)
Mains the image resize only.
protected virtual void ResizeMain(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
int
The new width.
newHeight
int
The new height.
resizeType
ResizeType
Type of the resize.
ResizeWidthProportionally(int, ResizeType)
Resizes the width proportionally.
public override void ResizeWidthProportionally(int newWidth, ResizeType resizeType)
Parameters
newWidth
int
The new width.
resizeType
ResizeType
Type of the resize.
Rotate(float, bool, Color)
Aspose.Imaging.RasterCachedMultipageImage.Rotate(System.Single,System.Boolean,Aspose.Imaging.Color) image around the center.
public override void Rotate(float angle, bool resizeProportionally, Color backgroundColor)
Parameters
angle
float
The rotate angle in degrees. Positive values will rotate clockwise.
resizeProportionally
bool
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.
RotateFlip(RotateFlipType)
Rotates, flips, or rotates and flips all pages.
public override void RotateFlip(RotateFlipType rotateFlipType)
Parameters
rotateFlipType
RotateFlipType
The rotate flip type.
RotateFlipAll(RotateFlipType)
Rotates the flip all.
[Obsolete("Please use RotateFlip instead of this method.")]
public virtual void RotateFlipAll(RotateFlipType rotateFlip)
Parameters
rotateFlip
RotateFlipType
The rotate flip.
RotateFlipMain(RotateFlipType)
Rotates the flip main.
protected virtual void RotateFlipMain(RotateFlipType rotateFlipType)
Parameters
rotateFlipType
RotateFlipType
Type of the rotate flip.
SavePixelsInternalMain(Rectangle, int[])
Saves the pixels internal main.
protected virtual void SavePixelsInternalMain(Rectangle rectangle, int[] pixels)
Parameters
rectangle
Rectangle
The rectangle.
pixels
int[]
The pixels.