freeimage - watermark

BlitzMax Forums/Brucey's Modules/freeimage - watermark

Pax(Posted 2011) [#1]
Hi, I want to use the paste method for alpha blending a logo into image:

SuperStrict
Framework BaH.FreeImage

Local logo:TFreeImage = LoadFreeImage("logo.png")
Local img:TFreeImage = LoadFreeImage("bk.jpg")

img.paste(logo,0,0, 255)

If Not img.save("water.png", FIF_PNG) Then
	DebugLog("Couldn't save the file...")
	End
End If


It works if I use a jpg file, but with a transparent .png, it doesn't. Also tried with alpha-channel .tga file, still no luck.

What am I missing here?

Thanks in advance.


Brucey(Posted 2011) [#2]
According to the docs, the bitmap you are pasting must have a depth equal to or less than the bitmap you are pasting onto. A png with alpha is likely to be 32bit, and a jpeg usually 24bit - which should mean that paste() returns false (i.e. the action failed).

Something like :
img = img.convertTo32Bits()

to bump the jpg up to 32bits might help here.

Although in my test it did not paste the image in the way I expected it to...


Pax(Posted 2011) [#3]
thank you for looking into this Brucey, I'll try to find another solution. Regards.