ImageEn, unit iemiscplugins |
|
TIEMiscPluginsImageMagick_OptimizeGIF
Declaration
function TIEMiscPluginsImageMagick_OptimizeGIF(InFileName, OutFilename: String; OptimizeLayers: Boolean = True; OptimizeTransparency: Boolean = True): Boolean;
Description
Optimizes a GIF animation (or multi-page GIF) by detecting differences between each frame and removing any data that is duplicated. The resulting file will only include differences between frames and can be significantly smaller.
Parameter | Description |
InFileName | The GIF file to be optimized |
OutFilename | The file to save the resulting GIF too |
OptimizeLayers | Compares each image the GIF disposed forms of the previous image in the sequence. From this it attempts to select the smallest cropped image to replace each frame, while preserving the results of the animation |
OptimizeTransparency | Compares the overlayed pixels against the disposal image resulting from all the previous frames in the animation. Any pixel that does not change the disposal image (and thus does not effect the outcome of an overlay) is made transparent |
Note:
◼You can also optimize GIF files with native ImageEn code using
IEOptimizeGIF
◼If you have an older download of the ImageMagick plug-in, you may need to move IM_MOD_RL_gif_.dll from the "Extra_Files" folder to your EXE folder
ImageEnMView1.MIO.SaveToFile('D:\temp.gif');
TIEMiscPluginsImageMagick_OptimizeGIF ('D:\temp.gif', 'D:\output.gif' );
// Create an animated GIF file from ten source images
mbmp := TIEMultiBitmap.create;
for i := 0 to 9 do
begin
mbmp.AppendImage( format( 'D:\Source\Frame %d.bmp', [i] ));
mbmp.Params[i].GIF_DelayTime := 10; // Display each frame for 1/10th of a second
end;
mbmp.SaveToFile( 'D:\animated.gif' );
mbmp.Free;
TIEMiscPluginsImageMagick_OptimizeGIF( 'D:\animated.gif', 'D:\animated-Opt.gif' );
See Also
◼IEOptimizeGIF
◼CheckAniGIF
◼DeleteGifIm
◼EnumGifIm (Image Count)
◼Global Image Methods
◼SaveToFileGIF
◼SaveToStreamGIF
◼ReplaceFileGIF
◼InsertToFileGIF