The code below correctly adds a color shade to a gray scale image.

I am having lots of problems keeping the image transparent though.  

It seems to create a white background which I can't make transparent.

Please help!



<html>

<head>

                <title>Transparent Image</title>

</head>

<body bgcolor="#ffff00">

<cfscript>

                locColor = "blue";

                locSourceFile = "transparent.gif";

                locDestinationFile = "transparent_#locColor#.gif";

                bgColor = "ffff00";

</cfscript>

<cfx_imageflare source="

b = Bitmap( '#expandpath('.\#locSourceFile#')#' )

for x=1, b.width, 1 do

                for y=1, b.height, 1 do

                                locGetPixel = b.getpixel(x,y)

                                if locGetPixel.alpha != 0 then

                                                locGetRed =
locGetPixel.red

                                                locGetGreen =
locGetPixel.green

                                                locGetBlue =
locGetPixel.blue

                                                               

                                                c = Color('#locColor#')

                                                locStaticColorRed =
c.red

                                                locStaticColorGreen =
c.green

                                                locStaticColorBlue =
c.blue


                                                newColor = Color (
((locGetRed + locStaticColorRed)/2),((locGetGreen +
locStaticColorGreen)/2),((locGetBlue + locStaticColorBlue)/2) )

                                                b.setpixel(x,y,newColor)

                                end

                end

  end

                b.save( '#expandpath('.\#locDestinationFile#')#' )

">

               

<cfoutput>

                <img src="" name="Source">

                <br>

                <img src="" name="Destination">

</cfoutput>

</body>

</html>

Ryan Duckworth
Macromedia ColdFusion Certified Professional
Uhlig Communications
10983 Granada Lane
Overland Park, KS 66211
(913) 754-4272
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to