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;using Leadtools.Pdf;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 objectusing (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 optionsCodecsWebpSaveOptions codecsWebpSaveOptions = codecs.Options.Webp.Save;Debug.WriteLine($"AnimationWidth: {codecsWebpSaveOptions.AnimationWidth}");// delete the output file in case you run this code more than onceFile.Delete(dstFile);// save all the pages, appending each new pagecodecs.Save(image, dstFile, RasterImageFormat.WebpAni, 0, 1, -1, 1, CodecsSavePageMode.Append);}}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";}
import java.io.File;import java.io.IOException;import java.net.URI;import java.net.URISyntaxException;import java.nio.file.Paths;import org.junit.*;import org.junit.runner.JUnitCore;import org.junit.runner.Result;import org.junit.runner.notification.Failure;import static org.junit.Assert.*;import leadtools.*;import leadtools.codecs.*;import leadtools.imageprocessing.core.MinMaxBitsCommand;// Saves an animated WEBP file.// Stores all animation frames in a single RasterImage object.public void codecsWebpSaveOptionsExample() {final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";String srcFile = combine(LEAD_VARS_IMAGES_DIR, "eye.gif");String dstFile = combine(LEAD_VARS_IMAGES_DIR, "eye.webp");// Load all the pages in the same RasterImage objectRasterCodecs codecs = new RasterCodecs();RasterImage image = codecs.load(srcFile, 0, CodecsLoadByteOrder.BGR_OR_GRAY, 1, -1);CodecsImageInfo info = codecs.getInformation(srcFile, true);codecs.getOptions().getWebp().getSave().setAnimationWidth(info.getGif().getAnimationWidth());codecs.getOptions().getWebp().getSave().setAnimationHeight(info.getGif().getAnimationHeight());codecs.getOptions().getWebp().getSave().setUseAnimationBackground(info.getGif().hasAnimationBackground());codecs.getOptions().getWebp().getSave().setAnimationBackground(info.getGif().getAnimationBackground());codecs.getOptions().getWebp().getSave().setUseAnimationLoop(info.getGif().hasAnimationLoop());codecs.getOptions().getWebp().getSave().setAnimationLoop(info.getGif().getAnimationLoop());codecs.getOptions().getWebp().getSave().setQualityFactor(0); // use lossless compressioninfo = null;// Retrieves Webp save optionsCodecsWebpSaveOptions codecsWebpSaveOptions = codecs.getOptions().getWebp().getSave();System.out.println("AnimationWidth: " + codecsWebpSaveOptions.getAnimationWidth());// delete the output file in case you run this code more than onceFile file = new File(dstFile);if (file.exists())file.delete();// save all the pages, appending each new pagecodecs.save(image, dstFile, RasterImageFormat.WEBP_ANI, 0, 1, -1, 1, CodecsSavePageMode.APPEND);assertTrue("File unsuccessfully saved to " + dstFile, (new File(dstFile)).exists());System.out.printf("File successfully saved to %s%n", dstFile);image.dispose();;codecs.dispose();;}
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
