Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode = 1
#Include "cgdiplus.inc"
Function PBMain() As Long
Local fName As WStringZ * %Max_Path, w,h As Long
fName = Exe.Path$ + "garyface.gif"
GetImageSize fName, w,h
? "w: + " + Str$(w) + " h: " + Str$(h)
End Function
Sub GetImageSize(fName As WStringZ * %Max_Path, w As Long, h As Long)
Local pGraphics,pImage As Dword
Local token As Dword, StartupInput As GdiplusStartupInput
StartupInput.GdiplusVersion = 1 'initialize GDIPlus
GdiplusStartup(token, StartupInput, ByVal %NULL) 'initialize GDIPlus
GdipLoadImageFromFile(fName, pImage) 'load image
GdipGetImageWidth(pImage,w) 'get width
GdipGetImageHeight(pImage, h) 'get height
If pImage Then GdipDisposeImage(pImage) 'cleanup
If pGraphics Then GdipDeleteGraphics(pGraphics) 'cleanup
GdiplusShutdown token 'shutdown GDI+
End Sub
'gbs_01316
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm