• ### Popular Now

• 10
• 9
• 13
• 10
• 18

#### Archived

This topic is now archived and is closed to further replies.

# JPEG - Color problems

This topic is 5969 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi! There was no answer in the "visual arts" forum - so i will try it at "Game programming": I am using directx7. I load my .bmp-graphics - all works well. But if i load the same graphics (using NViewLib.dll) as .jpg, it seems that black (my colorkey) is not really black. For example around yellow colors there are a lot of pixels that appears not transparent. I use Adobe photoshop to save the .bmp as .jpg (highest quality). Any ideas? It would be nice to use .jpg to get a downloadable game. Thanks McMc

##### Share on other sites
In the structure DDCOLORKEY
typedef struct _DDCOLORKEY{  DWORD dwColorSpaceLowValue;   DWORD dwColorSpaceHighValue;} DDCOLORKEY, FAR* LPDDCOLORKEY;

Did you set both high and low value to black? If so, be careful as jpeg compression doesn''t store images in a similar fashion to gif/bmp. Black areas may not be wholly black and may be approximated over a wide range of values. Give a higher range to the high and low values and see if that makes a difference.

SC

##### Share on other sites
I am pretty sure the problem is solved if you don''t use a single color for transparency, but a color-range.

If you use BMPs, the right color for each Pixel is stored, but if you use JPGs compression, it will only store "A color close to the one you wanted". So a JPG black isn''t the same black at all places.
Your eye can''t differ a RGB 0-0-0 black from a 0-1-1 black, but for transperency it does differ.

Hope this helps.