Table of Contents

Class ImageConverter

Namespace
Dynamicweb.Imaging.ImageHandling
Assembly
Dynamicweb.Core.dll

Applies transformations to images based on parameters

public class ImageConverter
Inheritance
ImageConverter
Inherited Members

Constructors

ImageConverter()

Creates new instance of this class.

public ImageConverter()

ImageConverter(string)

Creates new instance of this class.

public ImageConverter(string sourceFile)

Parameters

sourceFile string

The virtual path to the image to be converted.

Properties

Parameters

Gets or sets the ConvertParameters object for this instance.

public ConvertParameters Parameters { get; set; }

Property Value

ConvertParameters

Methods

ColorModeFromString(string)

Colors the mode from string.

public static ColorMode ColorModeFromString(string mode)

Parameters

mode string

The color mode as string.

Returns

ColorMode

Convert(ConvertParameters)

Converts the image and returns the contents of the converted image.

public static byte[] Convert(ConvertParameters convertParameters)

Parameters

convertParameters ConvertParameters

The conversion parameters.

Returns

byte[]

The contents of the converted image.

Exceptions

ConvertException

Thrown when unable to process the image file using the given parameters.

Convert(string, string, int)

Converts the image.

public static void Convert(string fromFile, string toFile, int width)

Parameters

fromFile string

The virtual path to the source file.

toFile string

The virtual path to the destination file.

width int

The width of the image.

Convert(string, string, int, int)

Converts the image.

public static void Convert(string fromFile, string toFile, int width, int height)

Parameters

fromFile string

The virtual path to the source file.

toFile string

The virtual path to the destination file.

width int

The width of the image.

height int

The height of the image.

Convert(string, string, int, int, OutputFormat)

Converts the image.

public static void Convert(string fromFile, string toFile, int width, int height, OutputFormat format)

Parameters

fromFile string

The virtual path to the source file.

toFile string

The virtual path to the destination file.

width int

The width of the image.

height int

The height of the image.

format OutputFormat

The format of the image.

Exceptions

ConvertException

Thrown when toFile already exists or any of files destinations are not specified

ConvertToFile(string)

Converts the source image according to conversion parameters.

public void ConvertToFile(string filePath)

Parameters

filePath string

The virtual path to the destination file.

Exceptions

ConvertException

Thrown when file already exists

GetOutputFileName(ConvertParameters)

Gets the name of the output file.

public static string GetOutputFileName(ConvertParameters convertParameters)

Parameters

convertParameters ConvertParameters

The convertParameters.

Returns

string

OutputFormatFromString(string)

Outputs the format from string.

public static OutputFormat OutputFormatFromString(string format)

Parameters

format string

The output format.

Returns

OutputFormat

Resize(string, int)

Resizes the image.

public static void Resize(string fromFile, int width)

Parameters

fromFile string

The virtual path to the source file.

width int

The width of the image.

Resize(string, int, int)

Resize the image.

public static void Resize(string fromFile, int width, int height)

Parameters

fromFile string

The virtual path to the source file.

width int

The width of the image.

height int

The height of the image.

Resize(string, int, int, OutputFormat)

Resize the image.

public static void Resize(string fromFile, int width, int height, OutputFormat format)

Parameters

fromFile string

The virtual path to the source file.

width int

The width of the image.

height int

The height of the image.

format OutputFormat

The format of the image.

Exceptions

ConvertException

Thrown when file cannot be found

StringFromColorMode(ColorMode)

Strings from color mode.

public static string StringFromColorMode(ColorMode mode)

Parameters

mode ColorMode

The mode.

Returns

string

StringFromOutputFormat(OutputFormat)

Strings from output format.

public static string? StringFromOutputFormat(OutputFormat currentFormat)

Parameters

currentFormat OutputFormat

The format.

Returns

string
To top