Thread: accessing pixels in an image - histograms help?

  1. #1
    Registered User
    Join Date
    Apr 2008

    accessing pixels in an image - histograms help?

    hi everyone, I have a question regarding images. I was hoping to create a program that looks at the pixel values in images sort of like a histogram. Anyway in my mind (im not a great programmer and this will probably be wrong I imagined it just being like reading a text file character by character only i would read an image pixel by pixel reading each ones value as i go along. Could it really be as simple as this? If anyone can point me in a starting direction i would much appreciate it or even websites i could possibly look at to research this?


  2. #2
    Registered User
    Join Date
    Apr 2008
    Sure, you can read a binary file and look at the bytes if you know the image format. You can probably find an image processing library to help.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > Could it really be as simple as this?
    For certain kinds of BMP files, yes it can be that simple.

    But for things like say PNG, you should use a library to get the pixels for you.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    For jpeg images, there are jpeg libraries available from various source.

    Windows is also capable of dealing with a fair number of image formats natively, such as BMP, JPEG, PNG - once you have loaded the image with LoadImage(), the pixels are available to you (using the relevant GDI functions).

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. Accessing an image stored in an array.
    By Mr.Sellars in forum C++ Programming
    Replies: 1
    Last Post: 07-11-2008, 11:46 AM
  3. Image rotation - doesn't always work
    By ulillillia in forum C Programming
    Replies: 12
    Last Post: 05-03-2007, 12:46 PM
  4. Replies: 4
    Last Post: 03-02-2003, 09:12 AM
  5. creating image from pixels stored in file
    By Kristian25 in forum Windows Programming
    Replies: 3
    Last Post: 01-21-2003, 02:08 PM