have you tried;
Graphics2D.drawImage(image,scaleOp,0,0);
or;
Graphics2D.drawImage(Image img, AffineTransform xform, ImageObserver
obs)
or last.. but not least.. the original graphics rescaler...
Graphics.drawImage(Image img, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2, Color bgcolor,
ImageObserver observer)
I regularly perform rescaling Operations on buffered
images(BufferedImage.TYPE_INT_RGB) this way
and have never encountered rescaling to be as slow as you report...
you should check the color space of the buffered image returned by
scaleOp.filter(...) as it could be returning
a BufferedImage with an sRGB color space and performing colorspace
conversions between the src & dst.
Regards
James Gardner
----- Original Message -----
From: "Carlos Rodriguez" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 30, 2001 11:17 AM
Subject: [JAVA2D] speed of AffineTransforms
> People:
>
> I recently had to change some of my code from JAI to Java2D because for
some
> reason JAI refuses
> to run properly in a servlet (I've already asked the JAI guys, didn't help
> much). Anyway, in my java2d code I have the following:
>
> 1)System.out.println("PixelXtractor: Starting affine transform");
> 2)AffineTransform scale = new AffineTransform();
> 3)scale.setToScale((double)factors[0],(double)factors[1]);
> 4)AffineTransformOp scaleOp = new
> AffineTransformOp(scale,AffineTransformOp.TYPE_BILINEAR);
> 5)BufferedImage retval = scaleOp.filter(result,null);
> 6)System.out.println("PixelXtractor: finished affine transform");
>
> Those six lines of code take 42 seconds to execute!
> On a PIII-500, with 256 MB of RAM!
>
> Can anyone suggest a faster way of doing this, that does not involve
> Graphics.DrawXXXXX (this is all offscreen)?
>
> My image is of TYPE_USHORT_GRAY and is 512 by 512. I don't even want to
> imagine how long a chest x-ray would take...
>
> Best Regards:
>
> Carlos M. Rodriguez, Senior Systems Engineer
> Wellogic Inc.
> 222 Third St. Suite. 2220. Cambridge, MA 02142 Ph: 617-621-9775 x.19
> "I look forward to a long period of immaturity followed by death"
> -Dave Barry
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".