CodecsWebpSaveOptions Class (original) (raw)

Summary

Provides options specifically for saving WebP images.

Syntax

C#

Objective-C

C++/CLI

Java

Python

public class CodecsWebpSaveOptions 
@interface LTCodecsWebpSaveOptions : NSObject 
public class CodecsWebpSaveOptions 
public ref class CodecsWebpSaveOptions  
class CodecsWebpSaveOptions: 

Example

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"; }

Leadtools.Codecs Assembly

CompactFile(Stream,Stream,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method

CompactFile(Stream,Stream,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method

CompactFile(string,string,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method

CompactFile(string,string,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method

StartCompress(int,int,int,RasterByteOrder,RasterViewPerspective,int,byte[],int,int,CodecsCompression,CodecsCompressDataCallback) Method