UtilImageConvertImageFile(String, String, BitmapEncoder) Method
Converts a image file to a different image format and saves the converted image to disk.
Namespace: DevCase.Core.Media.GraphicsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static void ConvertImageFile(
string srcFile,
string dstFile,
BitmapEncoder encoder
)
Public Shared Sub ConvertImageFile (
srcFile As String,
dstFile As String,
encoder As BitmapEncoder
)
Dim srcFile As String
Dim dstFile As String
Dim encoder As BitmapEncoder
UtilImage.ConvertImageFile(srcFile, dstFile,
encoder)
public:
static void ConvertImageFile(
String^ srcFile,
String^ dstFile,
BitmapEncoder^ encoder
)
static member ConvertImageFile :
srcFile : string *
dstFile : string *
encoder : BitmapEncoder -> unit
No code example is currently available or this language may not be supported.
Parameters
- srcFile String
-
The source image file path.
- dstFile String
-
The destination image file path.
- encoder BitmapEncoder
-
A BitmapEncoder instance
(BmpBitmapEncoder,
GifBitmapEncoder,
JpegBitmapEncoder,
PngBitmapEncoder or
TiffBitmapEncoder)
that represents the encoder and its parameters.
This is a code example that converts PNG files to JPEG format.
No code example is currently available or this language may not be supported.
' PNG image files.
Dim imageFiles As IEnumerable(Of FileInfo) = New DirectoryInfo("C:\Images").EnumerateFiles("*.png", SearchOption.TopDirectoryOnly)
For Each imgFile As FileInfo In imageFiles
' Convert PNG image to JPEG.
ConvertImageFile(imgFile.FullName, Path.ChangeExtension(imgFile.FullName, "jpg"), New JpegBitmapEncoder With {.QualityLevel = 95})
Console.WriteLine($"Image Converted: {imgFile.FullName}")
'' Send old PNG image to Recycle Bin.
' My.Computer.FileSystem.DeleteFile(imgFile.FullName, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
Next imgFile
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.