Click here to Skip to main content
15,882,114 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I want to display a gray 3D picture. How can i get the raw data from the gray image like a.png and b.png? thank you very much!
Posted
Updated 12-Jul-22 15:54pm
Comments
enhzflep 2-Mar-15 6:13am    
Which OS are you using?

Try using
stbi_image
you can download it and include to your project, its a header file it support multiple image formats
 
Share this answer
 
Comments
merano99 13-Jul-22 16:22pm    
nice, my 5!

As an example of image processing, the loaded image is converted to gray and saved to disk.The example shows how to iterate over image data and how to access and change the pixel values.
https://solarianprogrammer.com/2019/06/10/c-programming-reading-writing-images-stb_image-libraries/#basic_usage
You can load the png into a memory dc and access and manipulate the bit directly. Some sample code you should find the great article CxImage.
 
Share this answer
 
I would suggest using a library like libpng if you want it to be platform independent.
It's also easier on Windows, e.g. with Loadimage().

www.libpng.org/pub/png/libpng.html

docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadimagew
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900