GIMP and SetMaskColor

BlitzMax Forums/BlitzMax Beginners Area/GIMP and SetMaskColor

DinoEntrails(Posted 2010) [#1]
I made some images in Gimp with a white background(I tried it with transparent as well) and I need blitzmax to make the white invisible. So, I use the following code to load it into my game:

SetMaskColor(255,255,255)
Global MarketButton1:TImage=LoadImage("MarketButton3.png")


and then I draw it, and it still has a white box around it. What am I doing wrong here? I have also tried editing it in Paint, but it still will not work.


therevills(Posted 2010) [#2]
Works for me:

SuperStrict

Graphics 800,600

SetMaskColor 255,0,255
Global sprite:TImage = LoadImage("sprite.png")

Repeat
	Cls
	DrawImage sprite, 100, 100
	Flip
Until AppTerminate()


What options are you selecting when saving your png?


DinoEntrails(Posted 2010) [#3]
That doesn't work for me. I tried it as a JPEG this time, and it has a bunch of white pixels around it, but it sort of masked it...


CGV(Posted 2010) [#4]
That could be caused by the white pixels not actually being white.

If they're even slightly off (255,254,255) they won't be masked.


Czar Flavius(Posted 2010) [#5]
A shot in the dark but try putting this after your Graphics command:
SetBlend(ALPHABLEND)
SetAlpha(1.0)



shinkiro1(Posted 2010) [#6]
it should work when completely deleting the background(so you just see a chess like pattern) and then save it as png. Be sure to check the option to save alpha when saving as png.


therevills(Posted 2010) [#7]
Upload your image so that we can try it out...


DinoEntrails(Posted 2010) [#8]
Espada's suggestion worked. I guess Gimp's white is not white.


Czar Flavius(Posted 2010) [#9]
Hm that still doesn't explain why the white mask doesn't work.


DinoEntrails(Posted 2010) [#10]
I think that it has something to do with Gimp's Greyscale tool, because whenever I use it, the image will not mask properly, but if I make it black and white using the desaturate tool, it works fine.


therevills(Posted 2010) [#11]
I did try white before and it worked fine, then I changed it to the "normal" mask colour of 255,0,255 - so it must be something with what Dino was doing with GIMP...


gameproducer(Posted 2010) [#12]
Also, in GIMP you can use png's that have transparent stuff - that way you don't need to mess with the masks.

And remember to use that
SetBlend(ALPHABLEND)
:)