Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #36443

Re: Can you resize with BufferedImage

From Knute Johnson <nospam@rabbitbrush.frazmtn.com>
Newsgroups comp.lang.java.programmer
Subject Re: Can you resize with BufferedImage
Date 2017-04-13 11:10 -0500
Organization A noiseless patient Spider
Message-ID <oco7n7$n8$1@dont-email.me> (permalink)
References (1 earlier) <ockuu9$oh6$1@dont-email.me> <87wpapzv42.fsf@Equus.decebal.nl> <ocl8os$qc7$1@dont-email.me> <oclfir$p3p$1@dont-email.me> <2c781f24-6e80-4e00-b8db-cb507c2b2993@googlegroups.com>

Show all headers | View raw


On 4/12/2017 10:20, Eric Douglas wrote:
>
> I've never used an AffineTransformOp. To change the size of an image
> I just generate a new image of the width/height/transparency I want.
> Then I get the Graphics of the new image, cast it to a Graphics2D,
> create a new AffineTransform, and set the translate/scale/rotate I
> want.  Then I call .setComposite(AlphaComposite.SrcOver) on the new
> image's Graphics2D, then just .drawImage() passing in the old image,
> the AffineTransform I just created, and the observer (normally
> null).
>
> Normally you want to maintain proportions, your x and y for the scale
> are both Math.min(newWidth / originalImageWidth, newHeight /
> originalImageHeight).
>

I've done it that way too.  I don't really know which is faster.

-- 

Knute Johnson

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Can you resize with BufferedImage Cecil Westerhof <Cecil@decebal.nl> - 2017-04-12 10:34 +0200
  Re: Can you resize with BufferedImage Martin Gregorie <martin@address-in-sig.invalid> - 2017-04-12 10:18 +0000
    Re: Can you resize with BufferedImage Cecil Westerhof <Cecil@decebal.nl> - 2017-04-12 14:08 +0200
      Re: Can you resize with BufferedImage Martin Gregorie <martin@address-in-sig.invalid> - 2017-04-12 13:06 +0000
        Re: Can you resize with BufferedImage Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-04-12 10:05 -0500
          Re: Can you resize with BufferedImage Eric Douglas <e.d.programmer@gmail.com> - 2017-04-12 08:20 -0700
            Re: Can you resize with BufferedImage Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-04-13 11:10 -0500
          Re: Can you resize with BufferedImage Martin Gregorie <martin@address-in-sig.invalid> - 2017-04-12 16:13 +0000

csiph-web