Load a transparent image

BlitzMax Forums/BlitzMax Programming/Load a transparent image

vinians(Posted 2010) [#1]
Hi friends its me again :D
What I need is the follow:
I need a generic image loader (a funcion) wich set transparency to top most point at left. How can I acomplish this? Im new to BMax
Thanks in advance!


Polan(Posted 2010) [#2]
paint what you want transparent in 1 color, for example pink (255,0,255)
then

setmaskcolor(255,0,255)
loadimage(path$)
...
(if you changed blend somewhere)
setblend MASKBLEND
then
drawimage

and that's it.


vinians(Posted 2010) [#3]
Thank you but what I want is a generic way to do this. Example:
I get 3 images from internet with 3 types of color used as background. Lets supose that this color is set at 0,0 position on the image. What I want is get this color and then set it as transparent (setmaskcolor(rr, gg, bb)) for example. With this way I will get a 'generic' way to determine transparent color using 0,0 as reference!
Thanks in advance!


Jesse(Posted 2010) [#4]
I'll show you one example to accomplish this:
first load the image as a pixmap readpixel at the position (0,0)
separate the colors read from position (0,0) in to separate variables
set the maskcolor to the colors read.
load the image.

now rinse and repeat for as many images as desired.;)


Czar Flavius(Posted 2010) [#5]
Use PNGs. They have an alpha channel that allows you to set transparency without having to use a particular mask colour.