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


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

Re: ImageIO/BufferedImage behaving inconsistently from one day to the next.

From "John B. Matthews" <nospam@nospam.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: ImageIO/BufferedImage behaving inconsistently from one day to the next.
Date 2012-06-20 14:26 -0400
Organization The Wasteland
Message-ID <nospam-31DE8E.14263820062012@news.aioe.org> (permalink)
References <jrrcl4$f5v$3@dont-email.me> <jrrfma$kdq$1@dont-email.me>

Show all headers | View raw


In article <jrrfma$kdq$1@dont-email.me>, markspace <-@.> wrote:

> On 6/19/2012 7:31 PM, Fred Greer wrote:
> > I have code that used to work perfectly, which processes images in 
> > certain ways, and today it suddenly was not working. I hadn't 
> > changed the code at all. I tracked the problem down to spurious 
> > IllegalArgumentExceptions being thrown by this code:
> >
> [...]
> So this is the code you say isn't working?  It works for me:
> 
> 
> package quicktest;
> 
> import java.awt.image.BufferedImage;
> import java.awt.image.ConvolveOp;
> import java.awt.image.Kernel;
> import javax.imageio.ImageIO;
> 
> /**
>   *
>   * @author Brenden
>   */
> public class ConvlPng {
> 
>     public static void main(String[] args)
>           throws Exception
>     {
>        BufferedImage png = ImageIO.read( 
> ConvlPng.class.getResourceAsStream( "conv_test.png" ) );
>        BufferedImage conv = blur( png );
>        System.out.println( conv );
>     }
> 
> 
>      private static float[] BLUR = {0.1111111f, 0.1111111f, 0.1111111f,
>                                     0.1111111f, 0.1111111f, 0.1111111f,
>                                     0.1111111f, 0.1111111f, 0.1111111f};
> 
>      public static BufferedImage blur (BufferedImage img) {
>          Kernel k = new Kernel(3, 3, BLUR);
>          ConvolveOp co = new ConvolveOp(k, ConvolveOp.EDGE_NO_OP, null);
>          BufferedImage dest = new BufferedImage(img.getWidth(),
>              img.getHeight(),img.getType());
>          co.filter(img,dest);
>          return dest;
>      }
> }

I couldn't resist adding a GUI:

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

and taking a picture:

<https://sites.google.com/site/trashgod/_/rsrc/1340216139027/convolution/ConvlPng.png>

-- 
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

ImageIO/BufferedImage behaving inconsistently from one day to the next. Fred Greer <fggreer@nospam.invalid> - 2012-06-20 02:31 +0000
  Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. markspace <-@.> - 2012-06-19 19:38 -0700
    Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. Fred Greer <fggreer@nospam.invalid> - 2012-06-20 03:07 +0000
  Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. markspace <-@.> - 2012-06-19 20:22 -0700
    Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. "John B. Matthews" <nospam@nospam.invalid> - 2012-06-20 14:26 -0400
  Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. Patricia Shanahan <pats@acm.org> - 2012-06-19 20:38 -0700
    Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. Fred Greer <fggreer@nospam.invalid> - 2012-06-20 04:08 +0000
  Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. Roedy Green <see_website@mindprod.com.invalid> - 2012-06-20 01:16 -0700
    Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. Joerg Meier <joergmmeier@arcor.de> - 2012-06-20 11:44 +0200
    Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. Fred Greer <fggreer@nospam.invalid> - 2012-06-21 00:22 +0000
  Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. Knute Johnson <nospam@knutejohnson.com> - 2012-06-20 08:39 -0700
    Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. Fred Greer <fggreer@nospam.invalid> - 2012-06-21 00:23 +0000
      Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. Knute Johnson <nospam@knutejohnson.com> - 2012-06-20 21:23 -0700
        Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. Fred Greer <fggreer@nospam.invalid> - 2012-06-21 04:58 +0000
          Re: ImageIO/BufferedImage behaving inconsistently from one day to the next. Knute Johnson <nospam@knutejohnson.com> - 2012-06-21 05:58 -0700

csiph-web