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
stringThe 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
Methods
ColorModeFromString(string)
Colors the mode from string.
public static ColorMode ColorModeFromString(string mode)
Parameters
mode
stringThe color mode as string.
Returns
Convert(ConvertParameters)
Converts the image and returns the contents of the converted image.
public static byte[] Convert(ConvertParameters convertParameters)
Parameters
convertParameters
ConvertParametersThe 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
stringThe virtual path to the source file.
toFile
stringThe virtual path to the destination file.
width
intThe 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
stringThe virtual path to the source file.
toFile
stringThe virtual path to the destination file.
width
intThe width of the image.
height
intThe 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
stringThe virtual path to the source file.
toFile
stringThe virtual path to the destination file.
width
intThe width of the image.
height
intThe height of the image.
format
OutputFormatThe 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
stringThe 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
ConvertParametersThe convertParameters.
Returns
OutputFormatFromString(string)
Outputs the format from string.
public static OutputFormat OutputFormatFromString(string format)
Parameters
format
stringThe output format.
Returns
Resize(string, int)
Resizes the image.
public static void Resize(string fromFile, int width)
Parameters
Resize(string, int, int)
Resize the image.
public static void Resize(string fromFile, int width, int height)
Parameters
fromFile
stringThe virtual path to the source file.
width
intThe width of the image.
height
intThe 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
stringThe virtual path to the source file.
width
intThe width of the image.
height
intThe height of the image.
format
OutputFormatThe 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
ColorModeThe mode.
Returns
StringFromOutputFormat(OutputFormat)
Strings from output format.
public static string? StringFromOutputFormat(OutputFormat currentFormat)
Parameters
currentFormat
OutputFormatThe format.