By the way, if it was a matter of faster processing for the box blur, I
think it would be effective for images that were of thumbnail size.

For larger images, you'd probably want to go with the gaussian.

<!----------------//------
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: Rick Root [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 13, 2006 8:58 AM
To: CF-Talk
Subject: Re: Code Comparison: Java - CF


Andy Matthews wrote:
> Good job Rick...
>
> Now to say that I don't know if I'm happy with the quality of that blur.
> It's sort of pixel-y. Could just be the amount of blur you put on it I
> suppose...

Well, box blurs aren't perfect, that's for sure.  They're faster than
gaussian blurs.

I've got the gaussian blur working:

Compare the two:

http://www.opensourcecf.com/imagecfc/thumbnail_test/compare.htm

It doesn't seem to be working the same way that photoshop does... My
gaussian blur (above) used a radius of 5.  To get a similar looking
gaussian blur of the original image in photoshop, the radius was only 2.

> Keep up the good work regardless...I assume that this is for adding into
> Image.cfc?

Yup.

I probably should write a java class to do all this math crap,
Coldfusion doesn't do it very well... it took nearly 3 minutes to
generate the gaussian blur!

I guess looping through an array of 105,200 pixels takes some time using
CFML.  I wonder if the code can be optimized... here it is if anyone
would like to make suggestions (other than going back to a java class)

for (y=0; y lt height; y=y+1) {
        index = y;
        ioffset = y*width;
        for (x=0; x lt width; x=x+1) {
                r = 0;
                g = 0;
                b = 0;
                a = 0;
                moffset = cols2;
                for (col = 0-cols2; col lte cols2; col=col+1) {
                        f = variables.arrObj.get(matrix, 
javacast("int",moffset+col));
                        if (f neq 0)
                        {
                                ix = x+col;
                                if ( ix lt 0 )
                                {
                                        ix = 0;
                                } else if ( ix gte width) {
                                        ix = width-1;
                                }
                                rgb = 
variables.arrObj.get(inPixels,javacast("int",ioffset+ix));
                                separatedRGB = separateRGB(rgb);
                                a = a + f * separatedRGB.rgbAlpha;
                                r = r + f * separatedRGB.rgbRed;
                                g = g + f * separatedRGB.rgbGreen;
                                b = b + f * separatedRGB.rgbBlue;
                        }
                }
                if (alpha) {
                        ia = clamp(a+0.5,0,255);
                } else {
                        ia = 255;
                }
                ir = clamp(r+0.5,0,255);
                ig = clamp(g+0.5,0,255);
                ib = clamp(b+0.5,0,255);
                newRGB = combineRGB(ia,ir,ig,ib);
                variables.arrObj.setInt(outPixels, javacast("int",index),
javacast("int",newRGB));
                index = index + height;
        }
}



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263931
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to