Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322638 - [Image loading] ImageLoader and Image from stream fail with certain animated gifs
Summary: [Image loading] ImageLoader and Image from stream fail with certain animated ...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 4.3 M1   Edit
Assignee: Carolyn MacLeod CLA
QA Contact: Silenio Quarti CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-13 06:52 EDT by Thomas Schindl CLA
Modified: 2012-06-25 14:22 EDT (History)
1 user (show)

See Also:


Attachments
Example project (30.58 MB, application/zip)
2010-08-13 06:54 EDT, Thomas Schindl CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2010-08-13 06:52:55 EDT
Attached you'll find a project which demonstrates an SWT for an image which opens perfectly in other image programs but fails on SWT.

There's only one image loading implementation which allows to load the image which is the purely native one new Image(Display,String) but because I need to show an animated give this doesn't help me a lot.

You'll have to adjust the path to the image for to make new Image(Display,String) work for you
Comment 1 Thomas Schindl CLA 2010-08-13 06:54:19 EDT
Created attachment 176543 [details]
Example project
Comment 2 Scott Kovatch CLA 2010-08-18 15:00:11 EDT
Carolyn owns image loader bugs. I verified this fails on Cocoa in HEAD. Exception is:

Loading image with stream failed.
org.eclipse.swt.SWTException: Invalid image
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.SWT.error(SWT.java:3969)
	at org.eclipse.swt.internal.image.GIFFileFormat.getExtensions(GIFFileFormat.java:156)
	at org.eclipse.swt.internal.image.GIFFileFormat.loadFromByteStream(GIFFileFormat.java:124)
	at org.eclipse.swt.internal.image.FileFormat.loadFromStream(FileFormat.java:48)
	at org.eclipse.swt.internal.image.FileFormat.load(FileFormat.java:84)
	at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:130)
	at org.eclipse.swt.graphics.ImageDataLoader.load(ImageDataLoader.java:22)
	at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:331)
	at org.eclipse.swt.graphics.Image.<init>(Image.java:502)
	at ImageLoaderTest.main(ImageLoaderTest.java:19)
Comment 3 Carolyn MacLeod CLA 2010-08-18 16:34:36 EDT
Cool GIF. 74 images. I can comment out one line (the one that throws the error), and get it to (mostly) work. There seems to be an unknown extension in the final image that has an id of "254". I am out of time to look at this today, so I will get back to it on Friday.
Comment 4 Carolyn MacLeod CLA 2012-06-25 14:22:15 EDT
Fixed > 20120625 for 4.3 M1
Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=ff9c15961deba7f09d9b58b96d5ee00c19a9ff6f

(Re: comment 3):
OK, "Friday" was a while ago... sorry about that. It turns out that the attached gif does not conform to the GIF spec, and even Firefox and Windows Picture Viewer fail to read the entire file. However, since they both salvage the gif by reading in as much as they can, and they can still animate the images up to the point where it is broken (image #74 of the animation), I decided to do the same thing. So this patch makes our gif loading code a little more lenient, and your gif will (mostly) load.