LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Displaying 8-bit images in 24-bit mode and vice versa (http://www.linuxquestions.org/questions/linux-general-1/displaying-8-bit-images-in-24-bit-mode-and-vice-versa-57106/)

yrraja 04-28-2003 02:35 AM

Displaying 8-bit images in 24-bit mode and vice versa
 
Hi,

I am having trouble displaying 8-bit images in 24-bit mode vice versa. I have images in XWD format and when i display them using the "xwud" utility, the image is displayed but everything in the background changes its color. The background turns normal only when I unselect or close this image window.

Similarly in 8-bit mode when I try to display 24-bit image, i get the following error:

"xwud: Error => Visual type is not large enough to hold all colors of the image."

I require this feature to test my application which displays images with different depths simultaniously. I am using following:

OS: Redhat Linux 7.3
System: P4 1.7GHz
VGA: NVidia GeForce2 MX/MX400

I have tested this application on Sun Solaris and it is working fine. Any one has any solution to this problem?

Regards,
Yaser

wapcaplet 04-28-2003 07:10 AM

I'm afraid I can't help you with implementation details much... Obviously you can't display 24-bit color in 8-bit mode, without doing some dithering or some such.

I know that when the entire screen changes color, it probably means that the display is adjusting its palette to match that of the image. For example, if you are in 8-bit mode, you can only have 256 colors on the screen at once. If you load an 8-bit image that uses 256 colors, the entire screen has to be drawn using colors from that image (again, assuming you don't dither using some standard color palette instead).

All I can offer is the suggestion: For 24 bit color depth, you should be able to display any images up to 24-bit color. If you're in 8-bit color depth, though, you'll have to do some approximation to the closest available color. Perhaps xwud has some option for doing this?

yrraja 04-28-2003 07:27 AM

Thanx wapcaplet,

In Sun Solaris i have used 'xwud' to display 24-bit images in 8-bit mode and 8-bit images in 24-bit mode successfully. Solaris somehow manages this, what i dont understand is why doesnt it work in Linux as well. The code for Solaris and Linux is almost the same except for minor differences. Therefore it has to be a limitation of either the hardware or linux X server.

Any comments will be appretiated.

Yaser

yrraja 04-29-2003 02:52 AM

Come on gurus.. tell me something!!

yrraja 04-29-2003 11:54 PM

Ok new informaion that i have is that in linux if I use the Overlay feature then i can display 8-bit image in 24-bit mode.

But the thing is i dont want that. I want the behaviou as Solaris shows. In Solaris this is done without the overlays, and an actual window of 8-bit depth is opened in 24-bit mode. If you check the properties of that window using 'xwininfo' command, it will show that this is 8-bit window using Pseudocolor. Similarly in 8-bit mode 24-bit images are displayed by opening a 24-bit window. So far it seems that this is some short coming of XFree86.

Any comments???

Yaser


All times are GMT -5. The time now is 03:40 PM.