Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Image manipulation
#1
GFL SDK is a library to load/save easily graphics formats.

It has the features :

Import about 100 graphic file formats
Export about 40 graphic file formats
Support of 10/12/16bits per component
Color mode convert
Lut transforms (brightness, contrast, ...)
Filters (blur, average, ...)
Tools (resize, de-interlace, ...)
And many other things...

GFL SDK is provided as FREEWARE for private non-commercial or educational use (including non-profit organization).

GFLAx is the ActiveX version of GFL SDK.

Home:
http://www.xnview.com/en/gfl.html

Download GFLAx (ActiveX/ASP component):
http://download.xnview.com/GflAxSetup.exe

Examples

Change bitmap file color depth
Code:
Copy      Help
typelib GflAx {059321F1-207A-47A7-93A1-29CDF876FDD3} 1.0
GflAx.GflAx g._create
;g.EnableLZW=TRUE ;;enable for gif
g.LoadBitmap(_s.expandpath("$my pictures$\bird.bmp"))
g.ChangeColorDepth(GflAx.AX_To16Colors 0 0)
g.SaveBitmap(_s.expandpath("$my pictures$\bird2.bmp"))

Create gif image with text
Code:
Copy      Help
str s="Text"

typelib GflAx {059321F1-207A-47A7-93A1-29CDF876FDD3} 1.0
GflAx.GflAx g._create
g.FontSize=20
int width=g.GetTextWidth(s)+8 ;;image width will depend on text
g.NewBitmap(width 24 0xffffff)
g.TextOut(s 4 2 0xff) ;;red
g.SaveFormat=2 ;;gif
g.EnableLZW=TRUE ;;needed for gif
g.SaveBitmap(_s.expandpath("$my pictures$\text.gif"))
#2
Function LoadImageAnyFormat
Code:
Copy      Help
;/
function# $_file

;Loads image of bmp, gif, jpg or other supported type.
;Returns bitmap handle. Later you must free it with DeleteObject.



typelib GflAx {059321F1-207A-47A7-93A1-29CDF876FDD3} 1.0 1
dll user32 #CopyImage handle un1 n1 n2 un2

str s.searchpath(_file)
if(!s.len) end "file does not exist"

if(s.endi(".bmp")) ret LoadImage(0 s IMAGE_BITMAP 0 0 LR_LOADFROMFILE)

GflAx.GflAx g._create
g.EnableLZW=TRUE ;;needed for gif
g.LoadBitmap(s)
stdole.IPicture p=g.GetPicture
ret CopyImage(p.Handle IMAGE_BITMAP g.width g.height 0)

See also in QM help:
LoadPictureFile
SaveBitmap
#3
I must say i love this!!

I created a nice macro that will let me create a "gif Badge" of anything that is in a text string.

I can really do some nice things with creating text badges for web pages that auto refresh with system info or other info.
An old blog on QM coding and automation.

The Macro Hook
#4
im getting an error when trying to use your function LoadImageAnyFormat

call function LoadImageAnyFormat:
Code:
Copy      Help
str sPath  =  "D:\Downloads\Compressed\1920 x 1200 collection\accelerator1920.jpg"
int b=LoadImageAnyFormat(sPath)


function LoadImageAnyFormat:
Code:
Copy      Help
;/
function# $_file

;Loads image of bmp, gif, jpg or other supported type.
;Returns bitmap handle. Later you must free it with DeleteObject.



typelib GflAx {059321F1-207A-47A7-93A1-29CDF876FDD3} 1.0 1
dll user32 #CopyImage handle un1 n1 n2 un2

str s.searchpath(_file)
if(!s.len) end "file does not exist"

if(s.endi(".bmp")) ret LoadImage(0 s IMAGE_BITMAP 0 0 LR_LOADFROMFILE)

GflAx.GflAx g._create
g.EnableLZW=TRUE ;;needed for gif
g.LoadBitmap(s)
stdole.IPicture p=g.GetPicture
ret CopyImage(p.Handle IMAGE_BITMAP g.width g.height 0)


error output:
Code:
Copy      Help
Error in LoadImageAnyFormat:  cannot load type library.

error line:
Code:
Copy      Help
typelib GflAx {059321F1-207A-47A7-93A1-29CDF876FDD3} 1.0 1

im using Windows Vista and my QM is Version 2.2.0.11 with up to date system folder
#5
Download http://download.xnview.com/GflAxSetup.exe and run. Works on Vista too.
#6
thank you, sorry about that i had a blonde moment.

///////////////////QUESTION////////////////////////
i know that SystemParametersInfo along with SPIF_SENDWININICHANGE needs a file path but is there a way of using the image handle ? without saving the file.

something like this:
Code:
Copy      Help
str sPath  =  "D:\Downloads\Compressed\1920 x 1200 collection\accelerator1920.jpg"
int b=LoadImageAnyFormat(sPath)
SystemParametersInfo SPI_SETDESKWALLPAPER 0 b SPIF_UPDATEINIFILE|SPIF_SENDWININICHANGE
10
DeleteObject(b)

i know im not asking this question very well sorry for that
#7
Must be file.
#8
thank u
#9
Could you give example how to resize image with gflax and export to JPG (adjusting JPG quality too)?

With some programs you can choose other options with JPG export too, such as sharpen colors, progressive browser display, etc...

I'm just starting to look into this, figured it would help this post to have this example since it it pretty common.

-jim
#10
Example. Captures image, resizes, saves as jpeg.
Macro Macro1679
Code:
Copy      Help
;save to
str sFile="$desktop$\test.jpg"
;resize to
int width(100) height(100)

;---------------------

;capture image from screen
str sTempFile.expandpath("$temp$\qm_image.bmp")
if(!CaptureImageOrColor(0 32 0 sTempFile)) ret

;resize
typelib GflAx {059321F1-207A-47A7-93A1-29CDF876FDD3} 1.0
GflAx.GflAx g._create
g.LoadBitmap(sTempFile)
g.Resize(width height)

;save as jpeg
g.SaveFormat=GflAx.AX_JPEG
g.SaveBitmap(_s.expandpath(sFile))

;---------------------

;show the image
run sFile
#11
Thanks. That gave me enough information to get rolling!

Do you know any way to load the GflAx.dll into a EXE, extract the dll, and load the library?

I tried a few things based on the LoadQmGridDllFromExe without any luck.

Thanks,
jim
#12
Why QM users want to add all files to exe? It is not common in programming. Why don't use a zip file or a setup program?

In any case, will need to register gflax as COM component on all computers. Registering requires admin. Also, exe will be big, because gflax is 1.1 MB.

With qmgrid easier. It is small, and don't need to register.

They also have dll version of the library. Not so easy to use, but will not need to register. I did not test.

Most COM components can be used without registering. Didn't test it with gflax.
Using COM components without registering
#13
How do you set an image to grey?

I figure it must be something like:
g.? = GflAx.AX_Grey

thanks,
Jim
#14
i would try these:
g.AdjustHLS
g.ChangeColorDepth
g.saturation
#15
more examples
Searching color from images
capture image and save in png format
get color from png file
find color or image in png file
#16
GflAx is great for most things. I've almost fully converted over from using Irfanview except for converting PDF's over to images (which actually uses ghost script). Thanks for more examples using such a great tool with QM!

-jim


Forum Jump:


Users browsing this thread: 2 Guest(s)