Jump to content
Sign in to follow this  

GDI+ any rules of thumb

Recommended Posts


Hi Guys

I am doing extensive work on a screen capture using GDI+, I would like someone to explain where and when to dispose of any

$hImage =_GDIPlus_ImageLoadFromFile("pic.bmp")  or createfrombitmap functions

do some work on it, may be 2 or 3 different clones, atleast 1


or should I dispose after each bit of work then load it again, or do I just add any var name to the end of my script just before




Share this post

Link to post
Share on other sites

You should create the $hImage, do on it all the work to do and then Dispose when this $hImage is no more needed in the script
So you can place _GDIPlus_ImageDispose($hImage) just before _GDIPlus_Shutdown(), or just after the whole work on $hImage, or just before another load if you need to create another $hImage to work on a different image

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.