Consulting

Results 1 to 5 of 5

Thread: Using excel to read pixel color in .bmp files

  1. #1

    Using excel to read pixel color in .bmp files

    If possible, I'd like to get excel to read the pixel color (RBG or hex) of various pixels from a .bmp file and write them out to a workbook.
    I've spent a good amount of time searching but have yet to get anything working.
    Bitmap.GetPixel was the most promising thing I could find, but none of the code examples will work in excel, they seemed to be intended for just VB(not VBA)

    Thank you,
    Chris

  2. #2
    MS Excel MVP VBAX Mentor Andy Pope's Avatar
    Joined
    May 2004
    Location
    Essex, England
    Posts
    344
    Location
    Hi,

    Have a look at these examples, not sure if Ivan's code is viewable though.
    http://www.xcelfiles.com/ImageToXL.html
    http://www.andypope.info/fun/bmpconvert.htm
    Cheers
    Andy

  3. #3
    Hi Andy,
    I think the second will get me where I want to go. The code does much more than I need (draws an entire picture vs getting a few pixels) but I should have a strong enough understanding of VBA to pull out the parts that will work for me.

    Based on your name, I'm going to guess it's yours?
    The code is clean and easy to understand, I wanted to thank you for that before I started toying with it.

    This is a little side project of my own, and I need to head to work at the moment, I'll probably work on your code tonight or over the weekend, will post how things turn out.

    Thanks again!

  4. #4
    VBAX Regular
    Joined
    May 2007
    Posts
    87
    Location
    I know this post is long since abandoned, but I've used your code to solve my hex reader issue Andy, Thanks for sharing it.

    I'm now just cutting out the parts I don't use and then I'll have to make an export function to put the processed data back into the BMP file.

    Thanks,

    -Andy.

  5. #5
    VBAX Newbie
    Joined
    Feb 2010
    Location
    Waterloo, Ontario, Canada
    Posts
    2
    Location
    This is definitely an old post, and I noticed the site says that the examples serve no real purpose, but at the moment I have the idea of taking a Cartographer map used to determine the location of precious ores in Minecraft and use it to plot their location in Excel.

    This is a great little example Andy!
    -Rick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •