// For complete examples and data files, please go to https://github.com/Muhammad-Adnan-Ahmad/Aspose.Imaging-for-Java
       
 // Sets the maximum allowed pixel difference. If greater than zero, lossy compression will be used.
 //  Recommended value for optimal lossy compression is 80. 30 is very light compression, 200 is heavy.
 com.aspose.imaging.Image image = com.aspose.imaging.Image.load(dataDir + "aspose-logo.gif");
 GifOptions gifExport = new GifOptions();
 gifExport.setMaxDiff(80);
 image.save(dataDir+"anim_lossy-80.gif", gifExport);