public class CodecsWebpSaveOptions
@interface LTCodecsWebpSaveOptions : NSObject
public class CodecsWebpSaveOptions
public ref class CodecsWebpSaveOptions
class CodecsWebpSaveOptions:
Obtain an instance of this class by getting the CodecsWebpOptions.Save property.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Core;
public void CodecsWebpSaveOptionsExample()
{
// Saves an animated WEBP file.
// Stores all animation frames in a single RasterImage object.
string srcFile = Path.Combine(LEAD_VARS.ImagesDir, @"eye.gif");
string dstFile = Path.Combine(LEAD_VARS.ImagesDir, @"eye.webp");
// Load all the pages in the same RasterImage object
using (RasterCodecs codecs = new RasterCodecs())
using (RasterImage image = codecs.Load(srcFile, 0, CodecsLoadByteOrder.BgrOrGray, 1, -1))
{
using (CodecsImageInfo info = codecs.GetInformation(srcFile, true))
{
codecs.Options.Webp.Save.AnimationWidth = info.Gif.AnimationWidth;
codecs.Options.Webp.Save.AnimationHeight = info.Gif.AnimationHeight;
codecs.Options.Webp.Save.UseAnimationBackground = info.Gif.HasAnimationBackground;
codecs.Options.Webp.Save.AnimationBackground = info.Gif.AnimationBackground;
codecs.Options.Webp.Save.UseAnimationLoop = info.Gif.HasAnimationLoop;
codecs.Options.Webp.Save.AnimationLoop = info.Gif.AnimationLoop;
codecs.Options.Webp.Save.QualityFactor = 0; // use lossless compression
}
// Retrieves Webp save options
CodecsWebpSaveOptions codecsWebpSaveOptions = codecs.Options.Webp.Save;
Debug.WriteLine($"AnimationWidth: {codecsWebpSaveOptions.AnimationWidth}");
// delete the output file in case you run this code more than once
File.Delete(dstFile);
// save all the pages, appending each new page
codecs.Save(image, dstFile, RasterImageFormat.WebpAni, 0, 1, -1, 1, CodecsSavePageMode.Append);
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document