Image Resizer : API Documentation

Type ImageState

Namespace ImageResizer.Resizing

Interfaces IDisposable

Encapsulates the state of an image being resized. Can be used to simulate a resize as well as actually perform one. All code should ignore when Bitmaps and Graphics objects are null, and go about simulating all the mathematical functions as normal.

Methods

Properties

Fields

Public instance methods

void ApplyCropping()

Applies copyRect (if it will have any effect), placing the result in preRenderBitmap, and resetting copyRect

void ConvertIfCMYK()

If 'sourceBitmap' is CMYK and `preRenderBitmap` is null, converts `sourceBitmap` to RGB and stores in 'preRenderBitmap'

void Dispose()

Disposes sourceBitmap, destGraphics, destBitmap, and copyAttributes if they are non-null

void EnsurePreRenderBitmap()

Clones 'sourceBitmap' into 'preRenderBitmap' if null.

void EnsureRGBA()

Ensures that the working bitmap is in 32bpp RGBA format - otherwise it is converted.

Public properties

SizeF copySize get;

(read-only) Same as copyRect.Size, convenience property.

Dictionary<string, object> Data get;

Allows extensions to store data along with the image state

Public fields

ResizeSettings settings

The commands to apply to the bitmap
return ResizeSettings

Size originalSize

The original size of the source bitmap. Use this instead of accessing the bitmap directly for this information, since the bitmap may not always be available
return Size

bool supportsTransparency

Rendering choices can depend on whether the output format supports transparency.
return bool

LayoutBuilder layout

The layout object. Used for calculated and flowing the layout of the various rings around the image (padding, border, effect, margin, etc).
return LayoutBuilder

Size destSize

The size of the target bitmap image. Set after all sizing operations have completed.
return Size

Size finalSize

The dimensions of the bitmap afer all operations have been applied to it (Calling FlipRotate can change the bitmap dimensions).
return Size

RectangleF copyRect

The rectangular portion of the source image to copy
return RectangleF

Bitmap sourceBitmap

The source bitmap. If null, skip drawing commands, but continue layout logic.
return Bitmap

Bitmap preRenderBitmap

An optional intermediate bitmap, created by plugins who need to process the source bitmap it gets rendered to destBitmap. If defined, it should be used instead of sourceBitmap during RenderImage(), and disposed immediately after use.
return Bitmap

Bitmap destBitmap

The destination bitmap. If null, skip drawing commands, but continue layout logic.
return Bitmap

Graphics destGraphics

A graphics object to write to the destination bitmap. If null, skip drawing commands, but continue layout logic.
return Graphics

ImageAttributes copyAttibutes

Allows color correction/modification during the image copy.
return ImageAttributes