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 3635192
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:52:23+00:00 2026-05-19T00:52:23+00:00

Assume you want to read an image file in a common file format from

  • 0

Assume you want to read an image file in a common file format from the hard drive, change the color of one pixel, and display the resulting image to the screen, in C++.

Which (open-source) libraries would you recommend to accomplish the above with the least amount of code?

Alternatively, which libraries would do the above in the most elegant way possible?

A bit of background: I have been reading a lot of computer graphics literature recently, and there are lots of relatively easy, pixel-based algorithms which I’d like to implement. However, while the algorithm itself would usually be straightforward to implement, the necessary amount of frame-work to manipulate an image on a per-pixel basis and display the result stopped me from doing it.

  • 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-05-19T00:52:23+00:00Added an answer on May 19, 2026 at 12:52 am

    The CImg library is easy to use.

    CImg<unsigned char> img("lena.png");              // Read in the image lena.png
    const unsigned char valR = img(10,10,0,0);        // Read the red component at coordinates (10,10)
    const unsigned char valG = img(10,10,0,1);        // Read the green component at coordinates (10,10)
    const unsigned char valB = img(10,10,2);          // Read the blue component at coordinates (10,10) (Z-coordinate omitted here).
    const unsigned char avg = (valR + valG + valB)/3; // Compute average pixel value.
    img(10,10,0) = img(10,10,1) = img(10,10,2) = avg; // Replace the pixel (10,10) by the average grey value.
    CImgDisplay main_disp(img, "Modified Lena");      // Display the modified image on the screen
    img.save("lena_mod.png");                         // Save the modified image to lena_mod.png
    

    It can also be used as a rather powerful image processing library. See the examples here.

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

Sidebar

Related Questions

I want to read and process sets of input from a file and then
I want to read a text file from my local directory, I added the
I have here this code. I want it to first display an image file
I want to read and write python-source-files from the file system in a thread-safe
Assume that I want to listen to a non-common port (9090 for example) 24/7
I want to do following: Make Oracle stored procedure for read all data from
I need to read and interpret a binary file containing a TIFF image. I
I need help in displaying an image from database. I've read that it's efficient
I have a text file that I want to read line by line and
I have a file that I want to read that is itself zipped within

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.