Class RasterCachedMultipageImage
The raster multipage image
public abstract class RasterCachedMultipageImage : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata, IMultipageImage
- Inheritance
-
RasterCachedMultipageImage
- Implements
- Derived
- Inherited Members
Constructors
RasterCachedMultipageImage()
Initializes a new instance of the RasterCachedMultipageImage class.
protected RasterCachedMultipageImage()
RasterCachedMultipageImage(IColorPalette)
Initializes a new instance of the RasterCachedMultipageImage class.
protected RasterCachedMultipageImage(IColorPalette colorPalette)
Parameters
colorPalette
IColorPaletteThe color palette.
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
- int
The image bits per pixel count.
HasAlpha
Gets a value indicating whether this instance has alpha.
public override bool HasAlpha { get; }
Property Value
- bool
true
if this instance has alpha; otherwise,false
.
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
- int
The image height.
ImageOpacity
Gets opacity of this image.
public override float ImageOpacity { get; }
Property Value
- float
The opacity value between 0.0 (fully transparent) and 1.0 (fully opaque).
IsCached
Gets a value indicating whether image data is cached currently.
public override bool IsCached { get; }
Property Value
- bool
true
if image data is cached; otherwise,false
.
PageCount
Gets the page count.
public abstract int PageCount { get; }
Property Value
- int
The page count.
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
- PageExportingAction
The page exporting action.
Pages
Gets the pages.
public abstract Image[] Pages { get; }
Property Value
- Image[]
The pages.
Width
Gets the image width.
public override int Width { get; }
Property Value
- int
The image width.
XmpData
Gets or sets XMP data from frame.
public override XmpPacketWrapper XmpData { get; set; }
Property Value
- XmpPacketWrapper
XMP packet data wrapper
Methods
AdjustBrightness(int)
Adjust of a brightness
for image.
public override void AdjustBrightness(int brightness)
Parameters
brightness
intBrightness value.
AdjustContrast(float)
Image contrasting
public override void AdjustContrast(float contrast)
Parameters
contrast
floatContrast value (in range [-100; 100])
AdjustGamma(float)
Gamma-correction of an image.
public override void AdjustGamma(float gamma)
Parameters
gamma
floatGamma for red, green and blue channels coefficient
AdjustGamma(float, float, float)
Gamma-correction of an image.
public override void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Parameters
gammaRed
floatGamma for red channel coefficient
gammaGreen
floatGamma for green channel coefficient
gammaBlue
floatGamma for blue channel coefficient
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
doubleThe brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
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
doubleThe brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
windowSize
intThe size of 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
byteThreshold 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
PointThe background image blending origin.
overlay
RasterImageThe overlay image.
overlayArea
RectangleThe overlay area.
overlayAlpha
byteThe overlay alpha.
Exceptions
- ImageException
Image exception
CacheData()
Caches the data private.
public override void CacheData()
CanDoAdjustments()
Determines whether this instance [can do adjustments].
protected virtual bool CanDoAdjustments()
Returns
- bool
true
if this instance [can do adjustments]; otherwise,false
.
Crop(Rectangle)
Cropping the image.
public override void Crop(Rectangle rectangle)
Parameters
rectangle
RectangleThe rectangle.
Crop(int, int, int, int)
Crop image with shifts.
public override void Crop(int leftShift, int rightShift, int topShift, int bottomShift)
Parameters
leftShift
intThe left shift.
rightShift
intThe right shift.
topShift
intThe top shift.
bottomShift
intThe bottom shift.
Exceptions
- 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.
CropMain(int, int, int, int)
Crops the main.
protected virtual void CropMain(int leftShift, int rightShift, int topShift, int bottomShift)
Parameters
leftShift
intThe left shift.
rightShift
intThe right shift.
topShift
intThe top shift.
bottomShift
intThe bottom shift.
Dither(DitheringMethod, int, IColorPalette)
Performs dithering on the current image.
public override void Dither(DitheringMethod ditheringMethod, int bitsCount, IColorPalette customPalette)
Parameters
ditheringMethod
DitheringMethodThe dithering method.
bitsCount
intThe final bits count for dithering.
customPalette
IColorPaletteThe custom palette for dithering.
Filter(Rectangle, FilterOptionsBase)
Filters the specified rectangle.
public override void Filter(Rectangle rectangle, FilterOptionsBase options)
Parameters
rectangle
RectangleThe rectangle.
options
FilterOptionsBaseThe 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
ImageOptionsBaseThe image options.
clippingRectangle
RectangleThe clipping rectangle.
pageNumber
intThe page number.
Returns
- Stream
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 GetSkewAngle() and Rotate(float, bool, Color) methods.
public override void NormalizeAngle(bool resizeProportionally, Color backgroundColor)
Parameters
resizeProportionally
boolif 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
ColorColor 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
intOld color ARGB value to be replaced.
oldColorDiff
byteAllowed difference in old color to be able to widen replaced color tone.
newColorArgb
intNew 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
intNew color ARGB value to replace non transparent colors with.
Resize(int, int, ImageResizeSettings)
Resizes the image.
public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)
Parameters
newWidth
intThe new width.
newHeight
intThe new height.
settings
ImageResizeSettingsThe resize settings.
Resize(int, int, ResizeType)
Resizes the image.
public override void Resize(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
intThe new width.
newHeight
intThe new height.
resizeType
ResizeTypeThe resize type.
ResizeHeightProportionally(int, ResizeType)
Resizes the width proportionally.
public override void ResizeHeightProportionally(int newHeight, ResizeType resizeType)
Parameters
newHeight
intThe new height.
resizeType
ResizeTypeType of the resize.
ResizeMain(int, int, ResizeType)
Mains the image resize only.
protected virtual void ResizeMain(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
intThe new width.
newHeight
intThe new height.
resizeType
ResizeTypeType of the resize.
ResizeWidthProportionally(int, ResizeType)
Resizes the width proportionally.
public override void ResizeWidthProportionally(int newWidth, ResizeType resizeType)
Parameters
newWidth
intThe new width.
resizeType
ResizeTypeType of the resize.
Rotate(float, bool, Color)
Rotate(float, bool, Color) image around the center.
public override void Rotate(float angle, bool resizeProportionally, Color backgroundColor)
Parameters
angle
floatThe rotate angle in degrees. Positive values will rotate clockwise.
resizeProportionally
boolif 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
ColorColor of the background.
RotateFlip(RotateFlipType)
Rotates, flips, or rotates and flips all pages.
public override void RotateFlip(RotateFlipType rotateFlipType)
Parameters
rotateFlipType
RotateFlipTypeThe 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
RotateFlipTypeThe rotate flip.
RotateFlipMain(RotateFlipType)
Rotates the flip main.
protected virtual void RotateFlipMain(RotateFlipType rotateFlipType)
Parameters
rotateFlipType
RotateFlipTypeType of the rotate flip.
SavePixelsInternalMain(Rectangle, int[])
Saves the pixels internal main.
protected virtual void SavePixelsInternalMain(Rectangle rectangle, int[] pixels)