Table of Contents

Class ImageExtensions

Namespace
NAPS2.Images
Assembly
NAPS2.Images.dll
public static class ImageExtensions
Inheritance
ImageExtensions
Inherited Members

Methods

AsTypeHint(ImageFileFormat)

public static string AsTypeHint(this ImageFileFormat imageFormat)

Parameters

imageFormat ImageFileFormat

Returns

string

Copy(IMemoryImage)

Creates a new image with the same content, dimensions, and resolution as this image.

public static IMemoryImage Copy(this IMemoryImage source)

Parameters

source IMemoryImage

Returns

IMemoryImage

Copy(IMemoryImage, ImageContext)

Creates a new image with the same content, dimensions, and resolution as this image.

public static IMemoryImage Copy(this IMemoryImage source, ImageContext imageContext)

Parameters

source IMemoryImage
imageContext ImageContext

Returns

IMemoryImage

CopyBlank(IMemoryImage)

Creates a new (empty) image with the same dimensions, pixel format, and resolution as this image.

public static IMemoryImage CopyBlank(this IMemoryImage source)

Parameters

source IMemoryImage

Returns

IMemoryImage

CopyBlankWithPixelFormat(IMemoryImage, ImageContext, ImagePixelFormat)

Creates a new (empty) image with the same dimensions and resolution as this image, and the specified pixel format.

public static IMemoryImage CopyBlankWithPixelFormat(this IMemoryImage source, ImageContext imageContext, ImagePixelFormat pixelFormat)

Parameters

source IMemoryImage
imageContext ImageContext
pixelFormat ImagePixelFormat

Returns

IMemoryImage

CopyBlankWithPixelFormat(IMemoryImage, ImagePixelFormat)

Creates a new (empty) image with the same dimensions and resolution as this image, and the specified pixel format.

public static IMemoryImage CopyBlankWithPixelFormat(this IMemoryImage source, ImagePixelFormat pixelFormat)

Parameters

source IMemoryImage
pixelFormat ImagePixelFormat

Returns

IMemoryImage

CopyTo(IMemoryImage, IMemoryImage)

Copies the content of this image to the destination image. It does not need to be the same pixel format, but if it's different, there may be some loss of information (e.g. when converting color to gray or black/white).

public static void CopyTo(this IMemoryImage source, IMemoryImage destination)

Parameters

source IMemoryImage
destination IMemoryImage

CopyWithPixelFormat(IMemoryImage, ImageContext, ImagePixelFormat)

Creates a new image with the same content, dimensions, and resolution as this image, but possibly with a different pixel format. This can result in some loss of information (e.g. when converting color to gray or black/white).

public static IMemoryImage CopyWithPixelFormat(this IMemoryImage source, ImageContext imageContext, ImagePixelFormat pixelFormat)

Parameters

source IMemoryImage
imageContext ImageContext
pixelFormat ImagePixelFormat

Returns

IMemoryImage

CopyWithPixelFormat(IMemoryImage, ImagePixelFormat)

Creates a new image with the same content, dimensions, and resolution as this image, but possibly with a different pixel format. This can result in some loss of information (e.g. when converting color to gray or black/white).

public static IMemoryImage CopyWithPixelFormat(this IMemoryImage source, ImagePixelFormat pixelFormat)

Parameters

source IMemoryImage
pixelFormat ImagePixelFormat

Returns

IMemoryImage

PerformAllTransforms(IMemoryImage, IEnumerable<Transform>)

public static IMemoryImage PerformAllTransforms(this IMemoryImage image, IEnumerable<Transform> transforms)

Parameters

image IMemoryImage
transforms IEnumerable<Transform>

Returns

IMemoryImage

PerformTransform(IMemoryImage, Transform)

public static IMemoryImage PerformTransform(this IMemoryImage image, Transform transform)

Parameters

image IMemoryImage
transform Transform

Returns

IMemoryImage

Render(IRenderableImage)

public static IMemoryImage Render(this IRenderableImage image)

Parameters

image IRenderableImage

Returns

IMemoryImage

Save(IRenderableImage, Stream, ImageFileFormat, ImageSaveOptions?)

Saves the image to the given stream. The file format must be specified.

public static void Save(this IRenderableImage image, Stream stream, ImageFileFormat imageFormat = ImageFileFormat.Unknown, ImageSaveOptions? options = null)

Parameters

image IRenderableImage

The image to save.

stream Stream

The stream to save the image to.

imageFormat ImageFileFormat

The file format to use.

options ImageSaveOptions

Options for saving, e.g. JPEG quality.

Save(IRenderableImage, string, ImageFileFormat, ImageSaveOptions?)

Saves the image to the given file path. If the file format is unspecified, it will be inferred from the file extension if possible.

public static void Save(this IRenderableImage image, string path, ImageFileFormat imageFormat = ImageFileFormat.Unknown, ImageSaveOptions? options = null)

Parameters

image IRenderableImage

The image to save.

path string

The path to save the image file to.

imageFormat ImageFileFormat

The file format to use.

options ImageSaveOptions

Options for saving, e.g. JPEG quality.

SaveToMemoryStream(IMemoryImage, ImageFileFormat, ImageSaveOptions?)

Saves the image to a new MemoryStream object. The file format must be specified.

public static MemoryStream SaveToMemoryStream(this IMemoryImage image, ImageFileFormat imageFormat, ImageSaveOptions? options = null)

Parameters

image IMemoryImage

The image to save.

imageFormat ImageFileFormat

The file format to use.

options ImageSaveOptions

Options for saving, e.g. JPEG quality.

Returns

MemoryStream

SaveToMemoryStream(IRenderableImage, ImageFileFormat, ImageSaveOptions?)

Saves the image to a new MemoryStream object. The file format must be specified.

public static MemoryStream SaveToMemoryStream(this IRenderableImage image, ImageFileFormat imageFormat, ImageSaveOptions? options = null)

Parameters

image IRenderableImage

The image to save.

imageFormat ImageFileFormat

The file format to use.

options ImageSaveOptions

Options for saving, e.g. JPEG quality.

Returns

MemoryStream

UpdateLogicalPixelFormat(IMemoryImage)

public static ImagePixelFormat UpdateLogicalPixelFormat(this IMemoryImage image)

Parameters

image IMemoryImage

Returns

ImagePixelFormat