Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 369318

Summary: Animated GIF Image Cannot Be Saved
Product: [Eclipse Project] Platform Reporter: Hashim Hashim <hashim_82>
Component: SWTAssignee: Carolyn MacLeod <carolynmacleod4>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, hashim_82, remy.suen
Version: 3.8   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug
Attachments:
Description Flags
Test Image none

Description Hashim Hashim CLA 2012-01-21 16:01:37 EST
Created attachment 209875 [details]
Test Image

Hello..
hope you are all doing good..
i need your kind and urgent support and advises to resolve the following issue...
i wrote a class that manipulates animated GIF images, my program works fine with some images while it doesn't with others when i call such that it throws the below exception when i want to save the image using  ImageLoader.save 

org.eclipse.swt.SWTException: Invalid image
There was an error loading the GIF
	at org.eclipse.swt.SWT.error(Unknown Source)
	at org.eclipse.swt.SWT.error(Unknown Source)
	at org.eclipse.swt.SWT.error(Unknown Source)
	at org.eclipse.swt.internal.image.GIFFileFormat.unloadIntoByteStream(Unknown Source)
	at org.eclipse.swt.internal.image.FileFormat.unloadIntoStream(Unknown Source)
	at org.eclipse.swt.internal.image.FileFormat.save(Unknown Source)
	at org.eclipse.swt.graphics.ImageLoader.save(Unknown Source)
	at org.eclipse.swt.graphics.ImageLoader.save(Unknown Source)
	at swttest.WriteTest02_b.main(WriteTest02_b.java:15)
BUILD SUCCESSFUL (total time: 0 seconds)

so i removed all the image manipulation code and my code became only the below, and the same problem is happening, also i attached one of the images that gives me this problem and when i remove the frames 24 to 30 of this image everything went fine so i think these frames have the problem but i don't know why?!! so i am afraid it will happen with me again

 

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;

public class WriteTest02_b {

    public static void main(String[] args) {
        ImageLoader loader;
        ImageData[] imageDataArray;
        String fileName = "01";
        loader = new ImageLoader();
        try {
            imageDataArray = loader.load(fileName + ".gif");
            loader.save(fileName + "_0.gif", SWT.IMAGE_GIF);

        } catch (SWTException ex) {
            ex.printStackTrace();
            System.out.println("There was an error loading the GIF");
        }
    }
} 



anyone can help please ....

thanks a lot
Comment 1 Wim Jongman CLA 2012-01-22 16:49:15 EST
moving to platform
Comment 2 Carolyn MacLeod CLA 2012-01-30 14:25:12 EST
Nice image. Are you able to modify the original image? The reason it is failing is because the 24th frame in the image (i.e. the very last frame of the animation) has a different depth than the first 23 frames. (The first 23 have depth 8, but the last one only has depth 4). I will review the animated GIF spec to see what the exact requirement is, however if you want to get up and running right away, you can change the depth of the last frame to 8 and then your whole image should load and unload without error.
Comment 3 Lars Vogel CLA 2019-11-27 07:37:44 EST
This bug hasn't had any activity in quite some time. Maybe the problem got
resolved, was a duplicate of something else, or became less pressing for some
reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it.
The information can be, for example, that the problem still occurs, that you
still want the feature, that more information is needed, or that the bug is
(for whatever reason) no longer relevant.

If the bug is still relevant, please remove the stalebug whiteboard tag.