Manipulating GIF files
Contents
[
Hide
]
Support of export readable full frame gif to multipage image formats
Aspose.Imaging supports for full-frame export from gif format.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String baseDirectoryPath = "D:\\"; | |
String fileName = "Animation.gif"; | |
String inputFilePath = baseDirectoryPath + fileName; | |
String outputFilePath = inputFilePath + "_FullFrame.tif"; | |
String outputFilePath1 = inputFilePath + "_NonFullFrame.tif"; | |
try (Image image = Image.load(inputFilePath)) | |
{ | |
MultiPageOptions multiPageOptions = new MultiPageOptions(new IntRange(2, 5)); | |
TiffOptions tiffOptions = new TiffOptions(TiffExpectedFormat.TiffDeflateRgb); | |
tiffOptions.setMultiPageOptions(multiPageOptions); | |
tiffOptions.setFullFrame(true); | |
image.save(outputFilePath, tiffOptions); | |
tiffOptions.setFullFrame(false); | |
image.save(outputFilePath1, tiffOptions); | |
} |
Support set of gif frame duration for all frames and option of the number of cycles in the GIF animation
Aspose.Imaging supports settting of gif frame duration and option of the number of cycles in the GIF animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.aspose.imaging.Image; | |
import com.aspose.imaging.fileformats.gif.GifImage; | |
import com.aspose.imaging.fileformats.gif.blocks.GifFrameBlock; | |
import com.aspose.imaging.imageoptions.GifOptions; | |
String filepath = "ezgif.com-gif-maker(1)___.gif"; | |
String outputPath = "output.gif"; | |
try (GifImage image = (GifImage)Image.load(filepath)) | |
{ | |
image.setFrameTime(2000); | |
((GifFrameBlock)image.getPages()[0]).setFrameTime(200); | |
image.save(outputPath, new GifOptions() {{ setLoopsCount(4); }}); | |
} |