Bug 38232 - Image encoders should support various depths
Summary: Image encoders should support various depths
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0   Edit
Hardware: PC All
: P3 enhancement with 5 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 120722 168071 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-05-29 09:15 EDT by Christophe Cornu CLA
Modified: 2022-02-23 13:00 EST (History)
16 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Cornu CLA 2003-05-29 09:15:28 EDT
Image encoders (note: encoders, not decoders) are only currently guaranteeing 
to work with an ImageData as provided by the matching decoder. This is not 
very useful since to really manipulate the ImageData a user often needs to 
create an Image and then gets a different ImageData back.

Image encoders should check the ImageData passed in and use the internal 
ImageData.bitblit call to convert it to a supported format 
(depth/scanlinepad/palette features). If a user needs more elaborate control 
over the details of image encoding (level of compression etc.), a third party 
library dedicated to handling image formats will have to be used. The proposed 
change will only serve the basic needs.
Comment 1 Remko Popma CLA 2004-02-15 10:06:48 EST
Do I understand correctly that this bug was split off from Bug 38186,
and that voting for this bug will allow people to save images as GIF files?
Comment 2 Christophe Cornu CLA 2004-02-16 08:56:22 EST
Saving an ImageData as a GIF is expected to work if your image data is of bit 
depth 1, 4 or 8. If you wish to be able to save into GIF an image with a 
different bit depth, yes you can vote for this PR.
Comment 3 Carolyn MacLeod CLA 2004-03-25 17:46:27 EST
ICO probably needs to handle more depths also.
Here's the current depths handled:
boolean isValidIcon(ImageData i) {
	if (!((i.depth == 1) || (i.depth == 4) || (i.depth == 8)))
		return false;
	int size = i.palette.colors.length;
	return ((size == 2) || (size == 16) || (size == 32) || (size == 256));
}
Comment 4 Carolyn MacLeod CLA 2006-02-03 14:22:16 EST
*** Bug 120722 has been marked as a duplicate of this bug. ***
Comment 5 Carolyn MacLeod CLA 2006-02-03 14:27:49 EST
Also, from the newsgroup:
[Eclipse 3.2M3, gtk]

Snippet194 (write an animated gif) throws with message "Unsupported
color depth" under linux.

This is because the return value from Image.getImageData() is always
24-bit-direct, since Image.init() blits the 4-bit indexed data into
24-bit direct data.
Comment 6 Carolyn MacLeod CLA 2007-01-02 13:57:56 EST
*** Bug 168071 has been marked as a duplicate of this bug. ***
Comment 7 Satyen Desai CLA 2007-06-01 14:21:15 EDT
I see the same behavior as comment #5 on MacOS X

Even though I'm creating an Image using Indexed (isDirect == false) ImageData with a depth of 4 (or 8), the image created always has a depth of 32 and is direct, due to the Image.init() blit call, resulting in "unsupported color depth" errors when using ImageLoader.save

Can you verify whether or not this will be addressed as part of the Linux-GTK duplicate bug
Comment 8 Hans Meier CLA 2010-01-31 14:05:09 EST
so....
is there a solution for this problem?
i'm trying to create some ImageData instances and put them into an array for the imageLoader instance, and it still gives me the depth error.
i do not want that the ImageData instances will be restricted to a very few number of colors...
please help.
Comment 9 Page CLA 2019-05-30 16:44:31 EDT
The issue still exists on E4.10, can it be fixed? We have lots of TIFF images getting this error!
Comment 10 Alexander Kurtakov CLA 2022-02-23 13:00:45 EST
Do you mind trying on Gtk with latest version? SWT now uses the gdkpixbuf library which has far better and broader support.