Thanks Micha,

The scaling works for me, I have no problem with that.

What I want to know is what Java is doing along the edges when bilinear
interpolation is specified.

For example, in my 5 x 25 example below, if I turn interpolation off and use
a screen magnifier, I can see columns which are 5 pixels wide and all of
uniform color/shade.

However, when I switch the  interpolation to bilinear, the columns are no
longer of uniform color/shade (as is expected), they 'blend' evenly across
the image from one column to another.

I understand that the 'inner' columns are 'blends' of their surrounding
pixels.

But on the far left and right edges, where there are only 'original' pixels
to one side or the other, I'm not sure how the color/shade is determined.

For example, if the original 5 x 25 image is scaled by 5 in the x direction
resulting in a 25 x 25 image, I would have expected that the first 3 columns
of pixels on the left in the resulting image would either be

1. all of uniform color/shade
2. a blend of the 'original' single pixel column with their background to
the left.

but my screen magnifier shows that neither is the case.

Does anyone know what algorithm the 2D API uses along the edges when using
bilinear interpolation and scaling for a buffered image?

Thanks,

Ted Hill
----- Original Message -----
From: "Michael D�rr" <[EMAIL PROTECTED]>
To: "Ted Hill" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, September 06, 2001 7:13 AM
Subject: Re: [JAVA2D] BufferedImage Interpolation


> The anser would be...
>
> AffineTransform t = new AffineTransform();
> ...
> t.setToScale(dx,dy); // here you set your magnification level ...
> if (mode ==1)    to = new AffineTransformOp
> (t,AffineTransformOp.TYPE_BILINEAR);
> else             to = new AffineTransformOp
> (t,AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
> res = to.filter(bi,null);
>
> Hope that helps ...
>
> Micha
>
>
>
>
> > If I have a BufferedImage which has
> >
> > Height 25 pixels
> > Width 5 pixels
> >
> > And I scale it so that it is displayed as square (25 x 25), how are the
> > pixels along the left edge and the right edge of the image determined
for
> > bilinear interpolation?
> >
> > In more detail:
> >
> > To make my tall thin image square, I do this:
> >
> > g2.scale(5, 1);    // scale by 5 in x, leave y alone
> >
> > g2.drawImage(myImage, 0, 0, this);
> >
> > So one column of pixels from the orig buffered image is displayed as 5
> > columns of pixels in the scaled image.
> >
> > I would expect that in the scaled image, the 'middle column' of each 5
> > column band would correspond to a single column of the original image.
> >
> > I would also expect that the four columns of the scaled image between
each
> > of the 'middle columns' would show values 'between' each of the middle
> > columns.
> >
> > But how would the two columns on the far left and the two columns on the
> > far
> > right of the scaled image be determined?
> >
> > Thank you,
> >
> > Ted Hill
> >
> >
>
===========================================================================
> > 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".
> >
>
> --
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
>
> --
> GMX Tipp:
>
> Machen Sie Ihr Hobby zu Geld bei unserem Partner 1&1!
> http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a
>

==========================================================================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".

Reply via email to