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


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

Re: Can you resize with BufferedImage

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Knute Johnson <nospam@rabbitbrush.frazmtn.com>
Newsgroups comp.lang.java.programmer
Subject Re: Can you resize with BufferedImage
Date Thu, 13 Apr 2017 11:10:08 -0500
Organization A noiseless patient Spider
Lines 21
Message-ID <oco7n7$n8$1@dont-email.me> (permalink)
References <871ssy10ub.fsf@Equus.decebal.nl> <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>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 13 Apr 2017 16:07:04 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="9d479cf69a0d3028b4dd55b295547597"; logging-data="744"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19l5QC9co6YWq8S4HL2rHEt"
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
In-Reply-To <2c781f24-6e80-4e00-b8db-cb507c2b2993@googlegroups.com>
Cancel-Lock sha1:lCnkFiG1aQ0VWZjylJmm7KJnd2I=
Xref csiph.com comp.lang.java.programmer:36443

Show key headers only | 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