+ Reply to Thread
Results 1 to 5 of 5

get pixel color from the image (gif/jpg/png)

  1. #1
    Registered User
    Join Date
    05-18-2015
    Location
    Japan
    MS-Off Ver
    2013
    Posts
    3

    get pixel color from the image (gif/jpg/png)

    Is there any way to get a RGB color of a pixel from the image gif/jpg/png? I tried to use getpixel() for this purpose, but for some reasons my code doesn't work. Thank you for your help in advance!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: get pixel color from the image (gif/jpg/png)

    Try out the function offered on this page:

    https://sim0n.wordpress.com/2009/03/...-pixel-colour/
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    05-18-2015
    Location
    Japan
    MS-Off Ver
    2013
    Posts
    3

    Re: get pixel color from the image (gif/jpg/png)

    Thank you JBeaucaire!

    Do you know how I can load a gif/jpg/png image file from my hdd to lDC ?

  4. #4
    Registered User
    Join Date
    05-18-2015
    Location
    Japan
    MS-Off Ver
    2013
    Posts
    3

    Re: get pixel color from the image (gif/jpg/png)

    Also when I compile this code on excel 2013 I get the following error: "user-defined type may not be passed ByVal"

  5. #5
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    251

    Re: get pixel color from the image (gif/jpg/png)

    Sorry to bring up an old thread, but I've just been playing with it myself and had the same problem yan1234 had.

    I fixed this by changing "ByVal" to "ByRef" on the affected line.

    Heres my current code;

    Please Login or Register  to view this content.
    Hope this helps anyone whos stumbled on this and struggled to make it work.

+ 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. Get pixel color from the image
    By cemregunay in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2014, 04:12 AM
  2. Pixel color of image
    By cemregunay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2014, 12:55 AM
  3. Save small 15x42 pixel two tone image in macro to avoid external file
    By NumberOCD in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-14-2011, 11:03 AM
  4. Accessing Image Pixel Data
    By RLang in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-19-2006, 10:20 PM
  5. How to read pixel color
    By keram in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2005, 06:36 PM

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