Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34408
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Bash script with Image Magick to a Java program |
| Date | 2016-05-27 23:23 +0200 |
| Organization | Decebal Computing |
| Message-ID | <877fef2o1k.fsf@Equus.decebal.nl> (permalink) |
| References | (2 earlier) <8760tz50qf.fsf@Equus.decebal.nl> <ni95r3$19j$1@dont-email.me> <871t4n4u12.fsf@Equus.decebal.nl> <nia17p$8ju$1@dont-email.me> <nia246$9g1$1@dont-email.me> |
On Friday 27 May 2016 20:02 CEST, Martin Gregorie wrote:
> I'm using:
> import java.awt.RenderingHints;
> import java.awt.geom.AffineTransform;
> import java.awt.image.AffineTransformOp;
> import java.awt.image.BufferedImage;
> import java.awt.image.BufferedImageFilter;
> import java.awt.image.BufferedImageOp;
> import java.awt.image.RescaleOp;
> import java.io.File;
> import java.io.IOException;
> import java.util.Hashtable;
> import javax.imageio.ImageIO;
> import org.gregorie.environ.ReportError;
>
> ... but obviously not all of them are being used to resize an image.
> Here's the code:
>
> public void resizeTo(int width)
> {
> re.trace(2, "resizeTo(" + width + ") started");
> int w = im.getWidth();
> int h = im.getHeight();
> double scale = width * 1.0 / w;
>
> if (noExpand && scale >= 1.0)
> {
> wouldExpand = true;
> re.trace(2, "Image is smaller than " + width +
> " wide: original size will be output");
> }
> else
> {
> wouldExpand = false;
> AffineTransform at = new AffineTransform();
> at.scale(scale, scale);
> AffineTransformOp op = new AffineTransformOp(at,
> AffineTransformOp.TYPE_BICUBIC);
> Double nw = new Double(w * scale);
> Double nh = new Double(h * scale);
> re.trace(2, "scale=" + scale +
> " new size w=" + nw.intValue() +
> " h=" + nh.intValue());
> re.trace(3, "Source buffer details: " + im);
> om = new BufferedImage(nw.intValue(),
> nh.intValue(),
> BufferedImage.TYPE_3BYTE_BGR);
> op.filter(im, om);
> }
>
> re.trace(1, "resizeTo(" + width + ") done");
> }
>
> The re.trace() calls are to my private traceing/debugging class
I will look into it. Thanks.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Bash script with Image Magick to a Java program Cecil Westerhof <Cecil@decebal.nl> - 2016-05-27 00:42 +0200
Re: Bash script with Image Magick to a Java program Jerry Stuckle <jstucklex@attglobal.net> - 2016-05-26 20:45 -0400
Re: Bash script with Image Magick to a Java program Cecil Westerhof <Cecil@decebal.nl> - 2016-05-27 11:01 +0200
Re: Bash script with Image Magick to a Java program Arne Vajhøj <arne@vajhoej.dk> - 2016-05-26 22:06 -0400
Re: Bash script with Image Magick to a Java program Cecil Westerhof <Cecil@decebal.nl> - 2016-05-27 11:06 +0200
Re: Bash script with Image Magick to a Java program Martin Gregorie <martin@address-in-sig.invalid> - 2016-05-27 10:00 +0000
Re: Bash script with Image Magick to a Java program Cecil Westerhof <Cecil@decebal.nl> - 2016-05-27 13:31 +0200
Re: Bash script with Image Magick to a Java program Eric Douglas <e.d.programmer@gmail.com> - 2016-05-27 05:15 -0700
Re: Bash script with Image Magick to a Java program Cecil Westerhof <Cecil@decebal.nl> - 2016-05-27 15:18 +0200
Re: Bash script with Image Magick to a Java program Duncan Idaho <duncan@dunenoemail.com> - 2016-05-27 18:51 +0100
Re: Bash script with Image Magick to a Java program Martin Gregorie <martin@address-in-sig.invalid> - 2016-05-27 18:02 +0000
Re: Bash script with Image Magick to a Java program Cecil Westerhof <Cecil@decebal.nl> - 2016-05-27 23:23 +0200
Re: Bash script with Image Magick to a Java program Cecil Westerhof <Cecil@decebal.nl> - 2016-05-27 23:18 +0200
Re: Bash script with Image Magick to a Java program Duncan Idaho <duncan@dunenoemail.com> - 2016-05-28 08:03 +0100
Re: Bash script with Image Magick to a Java program Arne Vajhøj <arne@vajhoej.dk> - 2016-05-27 17:59 -0400
Re: Bash script with Image Magick to a Java program Brixomatic <brixomatic@yahoo.com> - 2016-05-29 17:28 +0200
Re: Bash script with Image Magick to a Java program Eric Douglas <e.d.programmer@gmail.com> - 2016-06-14 10:25 -0700
csiph-web