GIMP and SetMaskColor
BlitzMax Forums/BlitzMax Beginners Area/GIMP and SetMaskColor
| ||
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. |
| ||
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? |
| ||
| 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... |
| ||
| 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. |
| ||
A shot in the dark but try putting this after your Graphics command:SetBlend(ALPHABLEND) SetAlpha(1.0) |
| ||
| 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. |
| ||
| Upload your image so that we can try it out... |
| ||
| Espada's suggestion worked. I guess Gimp's white is not white. |
| ||
| Hm that still doesn't explain why the white mask doesn't work. |
| ||
| 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. |
| ||
| 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... |
| ||
| 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) :) |