How to autocrop an image with VBA in PowerPoint?

Viewed 109

I am trying to find where the color differs and then crop that part of the image out of it.

Is there any method to get a pixel by pixel image color?

I don't think I can based off of these methods and because it is a bitmap image.

I know there is a set transparent method but the problem is I need to set the widths or heights of logos to be the same height/width and the transparent function doesn't change the size of the picture

If a method does this I would write a function that finds where the image changes from white and then crop from the top middle and bottom.

Example image
enter image description here

1 Answers

As far as I can tell it is impossible to do so within Powerpoint, however there might be a way using outside conditions such as by opening an excel project and using the code from this post VBA Get Colour of Pixel. I'm sorry that I cannot help you in any other way. My main suggestion would be to use normal numbers to crop it. Perhaps if you found a specific thing between the images that was different (Such as one type of image's height was different than the other type of image so you could use that to know how far to crop the image.), however as far as I can tell, No. There is no way to do this with powerpoint unless they added a feature.

Related