Jump to content
Sign in to follow this  
ovideo

Simple way to replace white with transparent in .png?

Recommended Posts

ovideo

Hello.

I am working on a script and i've hit a wall. Short story: i'm at the point where i need to make a .png transparent, like you can do manually with irfanview (all the colors remain the same, only white becomes transparent). I don't need anything fancy, but it would help if it were very fast... perhaps a color remap of some sort?

This is where it goes in:

; either make the png at $_PngPath2 transparent...
$_Image = _GDIPlus_ImageLoadFromFile($_PngPath2)
; or make $_Image transparent
_SetBitmap($_gui, $_Image, 255, $_m, $_m) ; -> puts the png on the GUI

If the png is transparent it is displayed properly, but unfortunately it's never transparent.

Help, please?

Share this post


Link to post
Share on other sites
ovideo

Problem solved, using ImageMagick Object, as presented

$img = ObjCreate("ImageMagickObject.MagickImage.1")
   $ret = $img.Convert($_PngPath2, _
        "-transparent", "white", _
        $_PngPath2

edit: my other problem had an obvious fix, seems i'm too tired.

Edited by ovideo

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  

×