Forum

Check if an image i...
 
Notifications
Clear all

Check if an image is all white or Fully Transparent

4 Posts
2 Users
0 Reactions
228 Views
(@marsil)
Posts: 72
Estimable Member
Topic starter
 

Hi,

Could you please help me.

Is there macro can check if an image is all white or fully transparent?

The Input will be path like this C:Usersehab.aliDesktopNew folder1000012.png in Column "A"

The output will be in Column B >> Status : White or Transparent or Color?

Thanks;

Marsil 

 
Posted : 23/12/2019 10:43 am
Philip Treacy
(@philipt)
Posts: 1632
Member Admin
 

Hi,

I haven't done this before but you may be able to use TransparentBackground to check if the image has any transparency

https://docs.microsoft.com/en-us/office/vba/api/excel.pictureformat.transparentbackground

 

I'm not aware of any function to check if an image is all white (or just one color) .  If one doesn't exist then I can only think that you'd have to check each pixel and you could do this with Windows API calls

https://stackoverflow.com/questions/16528319/read-pixel-colors-of-an-image

https://stackoverflow.com/questions/44847008/how-to-read-pixels-from-a-picture-file-with-excel-vba

https://stackoverflow.com/questions/45998565/scan-image-pixel-by-pixel-in-vba

 

Regards

Phil

 
Posted : 23/12/2019 10:35 pm
(@marsil)
Posts: 72
Estimable Member
Topic starter
 

Hi Philip,

Thank you very much for your support and valuable information.

Please can you help to create the macro and how I can use it for below code.

https://docs.microsoft.com/en-us/office/vba/api/excel.pictureformat.transparentbackground

Can you please send me sample in macro.

Thanks;

Marsil 

 
Posted : 24/12/2019 12:01 pm
Philip Treacy
(@philipt)
Posts: 1632
Member Admin
 

Hi Marsil,

Have you tried to write the macro?  I'm happy to help you out if you get stuck but I'm sorry I don't have time to write things from scratch.  The best way for you to learn is to give it a go 🙂

Regards

Phil

 
Posted : 27/12/2019 3:06 am
Share: