C#
VB
Java
Objective-C
WinRT C#
C++
Provides extra options for loading and saving GIF images.
public class CodecsGifOptions Public Class CodecsGifOptions public sealed class CodecsGifOptions @interface LTCodecsGifOptions : NSObject public class CodecsGifOptions function Leadtools.Codecs.CodecsGifOptions() public ref class CodecsGifOptions
using Leadtools;using Leadtools.Codecs;public void CodecsGifOptionsExample(){RasterCodecs codecs = new RasterCodecs();string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "eye.gif");// Get all Information about the Gif file that you want to load.CodecsImageInfo imageInfo = codecs.GetInformation(srcFileName, true);// set the animation loop value.if (imageInfo.Gif.HasAnimationLoop){codecs.Options.Gif.Load.AnimationLoop = imageInfo.Gif.AnimationLoop;if (imageInfo.Gif.AnimationLoop > 10)codecs.Options.Gif.Save.AnimationLoop = 10;}// if this image that you want to load uses the Animation loop then use it in the save options.codecs.Options.Gif.Save.UseAnimationLoop = imageInfo.Gif.HasAnimationLoop;// if this image that you want to load uses the Animation Background then use it in the save options.if (imageInfo.Gif.HasAnimationBackground)codecs.Options.Gif.Save.AnimationBackground = imageInfo.Gif.AnimationBackground;// if this image that you want to load uses the Animation Palette then use it in the save options.if (imageInfo.Gif.HasAnimationPalette)codecs.Options.Gif.Save.SetAnimationPalette(imageInfo.Gif.GetAnimationPalette());codecs.Options.Gif.Save.UseAnimationPalette = imageInfo.Gif.HasAnimationPalette;// if this image that you want to load uses the Intrlaced option, then use it otherwise don't use it.codecs.Options.Gif.Save.Interlaced = imageInfo.Gif.IsInterlaced;codecs.Options.Gif.Save.AnimationWidth = imageInfo.Gif.AnimationWidth;codecs.Options.Gif.Save.AnimationHeight = imageInfo.Gif.AnimationHeight;RasterImage srcImage = codecs.Load(srcFileName);codecs.Save(srcImage, Path.Combine(LEAD_VARS.ImagesDir, "gif1.gif"), RasterImageFormat.Gif, srcImage.BitsPerPixel, 1, srcImage.PageCount, 1, CodecsSavePageMode.Overwrite);//change some save options and save the image in a new file.codecs.Options.Gif.Save.UseAnimationLoop = true;codecs.Options.Gif.Save.AnimationLoop = 1;codecs.Options.Gif.Save.AnimationWidth = imageInfo.Gif.AnimationWidth + 100;codecs.Options.Gif.Save.AnimationHeight = imageInfo.Gif.AnimationHeight + 100;//Saving the image after the Gif setting.codecs.Save(srcImage, Path.Combine(LEAD_VARS.ImagesDir, "gif2.gif"), RasterImageFormat.Gif, srcImage.BitsPerPixel, 1, srcImage.PageCount, 1, CodecsSavePageMode.Overwrite);// Clean upsrcImage.Dispose();codecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.CodecsPublic Sub CodecsGifOptionsExample()Dim codecs As RasterCodecs = New RasterCodecs()Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "eye.gif")' Get all Information about the Gif file that you want to load.Dim imageInfo As CodecsImageInfo = codecs.GetInformation(srcFileName, True)' set the animation loop value.If imageInfo.Gif.HasAnimationLoop Thencodecs.Options.Gif.Load.AnimationLoop = imageInfo.Gif.AnimationLoopIf imageInfo.Gif.AnimationLoop > 10 Thencodecs.Options.Gif.Save.AnimationLoop = 10End IfEnd If' if this image that you want to load uses the Animation loop then use it in the save options.codecs.Options.Gif.Save.UseAnimationLoop = imageInfo.Gif.HasAnimationLoop' if this image that you want to load uses the Animation Background then use it in the save options.If imageInfo.Gif.HasAnimationBackground Thencodecs.Options.Gif.Save.AnimationBackground = imageInfo.Gif.AnimationBackgroundEnd If' if this image that you want to load uses the Animation Palette then use it in the save options.If imageInfo.Gif.HasAnimationPalette Thencodecs.Options.Gif.Save.SetAnimationPalette(imageInfo.Gif.GetAnimationPalette())End Ifcodecs.Options.Gif.Save.UseAnimationPalette = imageInfo.Gif.HasAnimationPalette' if this image that you want to load uses the Intrlaced option, then use it otherwise don't use it.codecs.Options.Gif.Save.Interlaced = imageInfo.Gif.IsInterlacedcodecs.Options.Gif.Save.AnimationWidth = imageInfo.Gif.AnimationWidthcodecs.Options.Gif.Save.AnimationHeight = imageInfo.Gif.AnimationHeightDim srcImage As RasterImage = codecs.Load(srcFileName)codecs.Save(srcImage, Path.Combine(LEAD_VARS.ImagesDir, "gif1.gif"), RasterImageFormat.Gif, srcImage.BitsPerPixel, 1, srcImage.PageCount, 1, CodecsSavePageMode.Overwrite)'change some save options and save the image in a new file.codecs.Options.Gif.Save.UseAnimationLoop = Truecodecs.Options.Gif.Save.AnimationLoop = 1codecs.Options.Gif.Save.AnimationWidth = imageInfo.Gif.AnimationWidth + 100codecs.Options.Gif.Save.AnimationHeight = imageInfo.Gif.AnimationHeight + 100'Saving the image after the Gif setting.codecs.Save(srcImage, Path.Combine(LEAD_VARS.ImagesDir, "gif2.gif"), RasterImageFormat.Gif, srcImage.BitsPerPixel, 1, srcImage.PageCount, 1, CodecsSavePageMode.Overwrite)' Clean upsrcImage.Dispose()codecs.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.Examples;using Leadtools.ImageProcessing;public void CodecsGifOptionsExample(Stream inStreamGif, Stream outStreamGif1, Stream outStreamGif2){RasterCodecs codecs = new RasterCodecs();// Get all Information about the Gif file that you want to load.CodecsImageInfo imageInfo = codecs.GetInformation(inStreamGif, true);// set the animation loop value.if (imageInfo.Gif.HasAnimationLoop){codecs.Options.Gif.Load.AnimationLoop = imageInfo.Gif.AnimationLoop;if (imageInfo.Gif.AnimationLoop > 10)codecs.Options.Gif.Save.AnimationLoop = 10;}// if this image that you want to load uses the Animation loop then use it in the save options.codecs.Options.Gif.Save.UseAnimationLoop = imageInfo.Gif.HasAnimationLoop;// if this image that you want to load uses the Animation Background then use it in the save options.if (imageInfo.Gif.HasAnimationBackground)codecs.Options.Gif.Save.AnimationBackground = imageInfo.Gif.AnimationBackground;// if this image that you want to load uses the Animation Palette then use it in the save options.if (imageInfo.Gif.HasAnimationPalette)codecs.Options.Gif.Save.SetAnimationPalette(imageInfo.Gif.GetAnimationPalette());codecs.Options.Gif.Save.UseAnimationPalette = imageInfo.Gif.HasAnimationPalette;// if this image that you want to load uses the Intrlaced option, then use it otherwise don't use it.codecs.Options.Gif.Save.Interlaced = imageInfo.Gif.IsInterlaced;codecs.Options.Gif.Save.AnimationWidth = imageInfo.Gif.AnimationWidth;codecs.Options.Gif.Save.AnimationHeight = imageInfo.Gif.AnimationHeight;RasterImage srcImage = codecs.Load(inStreamGif);codecs.Save(srcImage, outStreamGif1, RasterImageFormat.Gif, srcImage.BitsPerPixel, 1, srcImage.PageCount, 1, CodecsSavePageMode.Overwrite);//change some save options and save the image in a new file.codecs.Options.Gif.Save.UseAnimationLoop = true;codecs.Options.Gif.Save.AnimationLoop = 1;codecs.Options.Gif.Save.AnimationWidth = imageInfo.Gif.AnimationWidth + 100;codecs.Options.Gif.Save.AnimationHeight = imageInfo.Gif.AnimationHeight + 100;//Saving the image after the Gif setting.codecs.Save(srcImage, outStreamGif2, RasterImageFormat.Gif, srcImage.BitsPerPixel, 1, srcImage.PageCount, 1, CodecsSavePageMode.Overwrite);// Clean upsrcImage.Dispose();}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingPublic Sub CodecsGifOptionsExample(ByVal inStreamGif As Stream, ByVal outStreamGif1 As Stream, ByVal outStreamGif2 As Stream)Dim codecs As RasterCodecs = New RasterCodecs()' Get all Information about the Gif file that you want to load.Dim imageInfo As CodecsImageInfo = codecs.GetInformation(inStreamGif, True)' set the animation loop value.If imageInfo.Gif.HasAnimationLoop Thencodecs.Options.Gif.Load.AnimationLoop = imageInfo.Gif.AnimationLoopIf imageInfo.Gif.AnimationLoop > 10 Thencodecs.Options.Gif.Save.AnimationLoop = 10End IfEnd If' if this image that you want to load uses the Animation loop then use it in the save options.codecs.Options.Gif.Save.UseAnimationLoop = imageInfo.Gif.HasAnimationLoop' if this image that you want to load uses the Animation Background then use it in the save options.If imageInfo.Gif.HasAnimationBackground Thencodecs.Options.Gif.Save.AnimationBackground = imageInfo.Gif.AnimationBackgroundEnd If' if this image that you want to load uses the Animation Palette then use it in the save options.If imageInfo.Gif.HasAnimationPalette Thencodecs.Options.Gif.Save.SetAnimationPalette(imageInfo.Gif.GetAnimationPalette())End Ifcodecs.Options.Gif.Save.UseAnimationPalette = imageInfo.Gif.HasAnimationPalette' if this image that you want to load uses the Intrlaced option, then use it otherwise don't use it.codecs.Options.Gif.Save.Interlaced = imageInfo.Gif.IsInterlacedcodecs.Options.Gif.Save.AnimationWidth = imageInfo.Gif.AnimationWidthcodecs.Options.Gif.Save.AnimationHeight = imageInfo.Gif.AnimationHeightDim srcImage As RasterImage = codecs.Load(inStreamGif)codecs.Save(srcImage, outStreamGif1, RasterImageFormat.Gif, srcImage.BitsPerPixel, 1, srcImage.PageCount, 1, CodecsSavePageMode.Overwrite)'change some save options and save the image in a new file.codecs.Options.Gif.Save.UseAnimationLoop = Truecodecs.Options.Gif.Save.AnimationLoop = 1codecs.Options.Gif.Save.AnimationWidth = imageInfo.Gif.AnimationWidth + 100codecs.Options.Gif.Save.AnimationHeight = imageInfo.Gif.AnimationHeight + 100'Saving the image after the Gif setting.codecs.Save(srcImage, outStreamGif2, RasterImageFormat.Gif, srcImage.BitsPerPixel, 1, srcImage.PageCount, 1, CodecsSavePageMode.Overwrite)' Clean upsrcImage.Dispose()End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
