Microsoft 64 bit MASM > Examples

GdipLoadImageFromFile example

(1/7) > >>

Vortex:
Hello,

Here is an example using the GdipLoadImageFromFile GDI+ function :

https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-image-flat


--- Code: ---LoadImgFromFile PROC filename:QWORD

LOCAL BmpImage  :QWORD
LOCAL hBitmap   :QWORD

        invoke  GdipLoadImageFromFile,filename,\
                ADDR BmpImage

        invoke  GdipCreateHBITMAPFromBitmap,BmpImage,\
                ADDR hBitmap,0

        invoke  GdipDisposeImage,BmpImage

        mov     rax,hBitmap
        ret

LoadImgFromFile ENDP
--- End code ---

The first paremeter of the GdipLoadImageFromFile function expects a UNICODE filename.

hutch--:
 :thumbsup:

Gunther:
Erol,

Your program is running fine.  :thumbsup: Do they always have to be *.bmp or *.jpg? I would like to try it once with *.tga.

Gunther

Gunther:
It doesn't seem to work with TGA images. That's a pity.

Gunther

jj2007:

--- Quote from: Gunther on February 19, 2021, 10:11:57 AM ---Do they always have to be *.bmp or *.jpg? I would like to try it once with *.tga
--- End quote ---

Gdi+ handles jpg, jpeg, png, gif, tif and ico files, see attachment (work in progress, use at your own risk etc). Unfortunately it doesn't work with tga :sad:

Navigation

[0] Message Index

[#] Next page

Go to full version