Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8463161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:23:24+00:00 2026-06-10T14:23:24+00:00

Some time ago I asked a question about saving hwnd into ppm file. Thanks

  • 0

Some time ago I asked a question about saving hwnd into ppm file. Thanks to a stackoverflow user I have solved my issue. Iy’s work correctly but I still have a problem: the red and blue color are inverted.

the code and my previous question where here:
hwnd to ppm issue

Here is the bitmap info data:

bi.biSize = sizeof(BITMAPINFOHEADER);    
bi.biWidth = w;    
bi.biHeight = -h;  
bi.biPlanes = 1;    
bi.biBitCount = 24;    
bi.biCompression = BI_RGB;    

bi.biSizeImage = 0;  
bi.biXPelsPerMeter = 0;    
bi.biYPelsPerMeter = 0;    
bi.biClrUsed = 0;    
bi.biClrImportant = 0;

I googled and it seems the problem is BI_RGB, and I should use BI_BITFIELDS … but I didn’t find documentation on how to use it.
And I really don’t want to read all data pixel by pixel in order to revert blue and red color.
Is there any way to get it done without doing it pixel by pixel ?

thanks in advance for your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:23:26+00:00Added an answer on June 10, 2026 at 2:23 pm

    In a 24bpp BMP, the pixels store their colors in least endian order. Blue is first, red is last. In PPM red is first, blue is last. Which largely explains why it is such an obscure image format on Windows. You’ll have to swap the storage order yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some time ago I asked a question about nested loops on SO and as
I asked this question about using the system-drawables in an Android-app some time ago:
I have asked this question some time ago to get an idea of speeding
Some time ago I was asked the strange question how would I implement map
I asked a question some time ago on java 2d pathfinding... Pathfinding 2D Java
This question was asked quite some time ago, and while it covers possible solutions
I asked another SOAP related question some time ago, which asks for a working
This is an extension to a question which I asked some time ago. I
Guys I've asked few days ago a question and didn't have really time to
Some time ago I developed a multilingual website and now they have asked me

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.