Toadums
Toadums

Reputation: 2812

What exactly does the XDGI format B8G8R8A8_UNorm mean?

I am having a little trouble figuring out what this image format means: B8G8R8A8_UNorm in directX. Is this 8bits per color channel? Does that mean that if you had the color 0xAABBCCFF, for example then the color would be:

, which is some sort of gray? How does this compare to R32G32B32A32_float for example?

For example. I am looking at the image in HxD, to see the hex. The first 8 bytes (after the head) are:

FB 52 6F 3F

Which is green. But then if I load the picture into Gimp, and look at the pixel, the pixel is pink (#FFF8B5B5 => ARGB). So not even one color channel is the same!

How could this be? What exactly does the B8G8R8A8_UNorm mean? And how can I put it into the same format as a normal image processing program would use? (ie. R = F8, G = B5, B = b5, A = FF for this example)

Upvotes: 0

Views: 2962

Answers (1)

Simon Whitehead
Simon Whitehead

Reputation: 65077

No, you're looking at it in the wrong order. It goes:

8-bit Blue, 8-bit Green, 8-Bit Red, 8-bit Alpha. 

You would reverse this to get:

3F 6F 52 FB
^A ^R ^G ^B

In C#:

Color c = Color.FromArgb(0x6F, 0x52, 0xFB); // Pink.
                          ^R     ^G    ^B

This results in #FF6F52FB, which is also different to Gimp. I'm going to assume the UNorm flag makes tiny adjustments to this. Perhaps it slightly lightens it.

It's not fully Pink.. but a weird Pink'ish color.

Upvotes: 2

Related Questions