Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LoadPicture error invalid picture

I am trying to take an image from a folder to check its width after that. To do it I am using the following peace of code:

         Dim pic As IPictureDisp
         Dim var As Variant
         var = "C:\Myfolder\Animage" & animationNum + 1 & ".png"
         pic = LoadPicture(var)

It is giving me "invalid picture" error. I tried also just using the following line:

        width = LoadPicture("C:\Myfolder\Animage" & animationNum + 1 & ".png").width

But it also gave me the same error. How can I load the picture?

EDIT

I try with a jpg image and it works... Does this function some issues with png files?

like image 299
Iban Arriola Avatar asked Jun 06 '26 13:06

Iban Arriola


1 Answers

From msdn.microsoft.com:

Graphics formats recognized by Visual Basic include bitmap (.bmp) files, icon (.ico) files, cursor (.cur) files, run-length encoded (.rle) files, metafile (.wmf) files, enhanced metafiles (.emf), GIF (.gif) files, and JPEG (.jpg) files.

.png is not supported.

like image 92
Aaron Thomas Avatar answered Jun 10 '26 18:06

Aaron Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!