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


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

Re: Image Thinning using JAVA

From "John B. Matthews" <nospam@nospam.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Image Thinning using JAVA
Date 2012-06-26 23:15 -0400
Organization The Wasteland
Message-ID <nospam-D8169E.23155626062012@news.aioe.org> (permalink)
References <csqdnUsK6PaldXTSnZ2dnUVZ_vednZ2d@giganews.com> <jsd9em$hur$1@dont-email.me>

Show all headers | View raw


In article <jsd9em$hur$1@dont-email.me>,
 Knute Johnson <nospam@knutejohnson.com> wrote:

>     public static BufferedImage convertToGray(BufferedImage image) {
>         BufferedImage gray = new BufferedImage(image.getWidth(),
>             image.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
>         ColorConvertOp op = new ColorConvertOp(
>             image.getColorModel().getColorSpace(),
>             gray.getColorModel().getColorSpace(), null);
>         op.filter(image, gray);
>         return gray;
>     }

Thanks for weighing in on this. Your approach has always worked 
flawlessly on JPG images, but I had trouble with a PNG file: the result 
was unusually dark, and a subsequent call to gray.getGrapics() failed. 
I'd welcome any insight you can offer.

> You can use the same technique as above with an AffineTransformOp, as 
> John Matthews mentioned, to scale an image.

I had good results with AffineTransformOp.TYPE_NEAREST_NEIGHBOR for 
down sampling:

<https://sites.google.com/site/trashgod/scaled>

As recently suggested by BGB:

<https://groups.google.com/d/msg/comp.lang.java.programmer/zH_xK85o2mA/V--P6ruObwUJ>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

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


Thread

Image Thinning using JAVA sumera <kanwal.sumera@yahoo.com> - 2012-06-26 11:50 -0500
  Re: Image Thinning using JAVA markspace <-@.> - 2012-06-26 10:21 -0700
  Re: Image Thinning using JAVA "John B. Matthews" <nospam@nospam.invalid> - 2012-06-26 14:39 -0400
  Re: Image Thinning using JAVA Knute Johnson <nospam@knutejohnson.com> - 2012-06-26 14:26 -0700
    Re: Image Thinning using JAVA "John B. Matthews" <nospam@nospam.invalid> - 2012-06-26 23:15 -0400
      Re: Image Thinning using JAVA Knute Johnson <nospam@knutejohnson.com> - 2012-06-26 22:04 -0700
        Re: Image Thinning using JAVA "John B. Matthews" <nospam@nospam.invalid> - 2012-06-27 21:35 -0400
  Re: Image Thinning using JAVA Roedy Green <see_website@mindprod.com.invalid> - 2012-06-27 07:01 -0700

csiph-web