Jump to content
  • Advertisement

Archived

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

xsketchyx

Image formats that swap RGB for BGR?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone understand the reasoning behind using BGR format instead of RGB in image files (such as TGA)? Or is it just one of those things...??? Just a mere curiosity...

Share this post


Link to post
Share on other sites
Advertisement
It just seems to me that TGA files for example were meant primarily to be displayed on computers, which as far as I know all video cards use RGB for their buffers... just seems like an interesting decision, and wondering if there''s a reason...

Share this post


Link to post
Share on other sites
BGR, its alphabetically sorted correctly :D

Honestly, I don''t know.

- Patrik Willbo

The Lord says He can get me out of this mess, but He''s pretty sure you''re fucked.
- Stephen (Braveheart)

Share this post


Link to post
Share on other sites
quote:
Original post by xsketchyx
Does anyone understand the reasoning behind using BGR format instead of RGB in image files (such as TGA)?


Well, why do people use CMYK?

Share this post


Link to post
Share on other sites
BGR is the little-endian version of RGB.

If you want to write your colors as numbers like 0xaarrggbb, so 0xff884400 would be a fully opaque orange, then on Intel, it''s stored as BGRA in memory, but on PPC (and other big-endian systems) it''s stored as ARGB in memory.

CMYK is used for printing; inks subtract color from white, as opposed to screens which add colors to black. The subtractive fundamental colors are cyan, magenta, and yellow; K (for blacK) is usually added to get better contrast and lower smear in the printing process, and isn''t needed in a "perfect" printing press (such a thing doesn''t exist).

Share this post


Link to post
Share on other sites
quote:
Original post by hplus0603
BGR is the little-endian version of RGB.

If you want to write your colors as numbers like 0xaarrggbb, so 0xff884400 would be a fully opaque orange, then on Intel, it''s stored as BGRA in memory, but on PPC (and other big-endian systems) it''s stored as ARGB in memory.

CMYK is used for printing; inks subtract color from white, as opposed to screens which add colors to black. The subtractive fundamental colors are cyan, magenta, and yellow; K (for blacK) is usually added to get better contrast and lower smear in the printing process, and isn''t needed in a "perfect" printing press (such a thing doesn''t exist).



Thanks, now it''s all making sense. Actually now I''m thinking duh...

Share this post


Link to post
Share on other sites
Actually, look at it this way. If you push your BBGGRR on the stack...

RR
GG
BB

...then when you pop it off, it comes out as RRGGBB. Perhaps it''s just some means of representing stuff...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It should be noted that the TGA format originated due to the Targa graphics cards which displayed 24bit color back when most people were still running 16 color (64 color palette) EGA graphics cards.

I believe the Targa cards did format the colors BGR rather than RGB. Targa never became the truecolor video standard because the company milked their monopoly - pretty much nobody owned one nor could they afford one.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!