+ Reply to Thread
Results 1 to 4 of 4

Extract numerical value from bmp file using VBA

  1. #1
    Registered User
    Join Date
    07-29-2018
    Location
    In the Queen's Shed
    MS-Off Ver
    2013
    Posts
    18

    Question Extract numerical value from bmp file using VBA

    I've looked at this site. The results are what I am after, but cannot repeat the trick using the code on said website. I guess this has something to do with 64-bit vs 32-bit-compatible code (?).

    Surely there must be a simpler way to extract the colour value of a pixel (with given x,y-coordinates) in a bitmap (*.bmp) to a numerical value using Excel VBA -only-, i.e. without using 3rd party software, APIs, or online converters, right...?

    So, I know for example the colour of the pixel located (100,100) pixels from the top left corner is red (R = 255, G = 0, B = 0). How do I get that information into a cell on an Excel worksheet?

    What is the simplest way to extract the colour value of a given pixel in a bitmap image of any size, colour depth or resolution please?

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Business (Win 10 - Work) & MS 365 Subscription Insider (Win 10 - Home)
    Posts
    47,176

    Re: Extract numerical value from bmp file using VBA

    Administrative Note:

    Although we value your privacy as much you do, it could be important that members have a rough idea of your location as the solutions they offer may be affected by your locale. For instance, you might in the future post questions which are related to your regional settings.

    With this in mind, please update your profile to something more precise (something such as UK, Europe, USA, UAE, etc. will suffice).

    Thank you for helping us to help you.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    5,503

    Arrow Re: Extract numerical value from bmp file using VBA


    Quote Originally Posted by Pak Mariman View Post
    What is the simplest way to extract the colour value of a given pixel in a bitmap image of any size, colour depth or resolution please?
    No easy way as Excel is obviously not a 'picture' software and as it does not directly work with pixels,
    VBA does not have any feature like you can see in your link as all is done via OS features (Windows)

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    5,503

    Arrow Re: Extract numerical value from bmp file using VBA


    Quote Originally Posted by Pak Mariman View Post
    I guess this has something to do with 64-bit vs 32-bit-compatible code (?).
    Maybe But you forgot to indicate what is your exact Excel version ?


    Quote Originally Posted by Pak Mariman View Post
    [] in a bitmap (*.bmp) to a numerical value using Excel VBA -only-, i.e. without using 3rd party software, APIs
    In the case of a .bmp file an idea is to not load the file within a worksheet - useless according to your constraints -
    but just reading it in binary mode in order to decode it in memory to a specific data structure
    so to follow this way you must first investigate on the official .bmp data type structure

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula to extract Numerical and Alpha value
    By rizmomin in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-14-2021, 04:03 PM
  2. [SOLVED] formula to extract numerical value with decimal not working
    By JEAN1972 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-16-2020, 03:51 PM
  3. How to extract numerical value after certain strings within a cell?
    By robbyvegas in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-13-2016, 04:01 AM
  4. Extract string based on numerical value (Date)
    By winmaxservices1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-27-2015, 04:07 AM
  5. [SOLVED] Extract Numerical part
    By rizmomin in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 05-09-2014, 09:33 AM
  6. [SOLVED] Extract Numerical part with VB Code
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-28-2014, 05:04 PM
  7. [SOLVED] Extract a numerical value after a text.
    By Ken64 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-24-2013, 02:30 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1