title: Adding filter to image in swing
body: <p>I need to set filter to the image..
  I make this :</p>
  
  <pre><code>        int type = BufferedImage.TYPE_INT_RGB;
          double panelHeight = frame.getHeight();
          double panelWidth = frame.getWidth();
          BufferedImage image = null;
          try {
              image = ImageIO.read(new File(frame.getURL()));
          } catch (IOException e1) {
              e1.printStackTrace();
          }
          int height = image.getHeight();
          int width = image.getWidth();
          for(int h=1; h &lt; height-1; h++) {
              for(int w=1; w &lt; width-1;w++) {
                  float color = ((1f/9f*image.getRGB(w-1, h-1))+(1f/9f* image.getRGB(w, h-1))+(1f/9f* image.getRGB(w+1, h-1))+
                          (1f/9f* image.getRGB(w-1, h))+(1f/9f* image.getRGB(w, h))+(1f/9f* image.getRGB(w+1, h))+
                          (1f/9f* image.getRGB(w-1, h+1))-(1f/9f* image.getRGB(w, h+1))-(1f/9f* image.getRGB(w+1, h+1)));
                  image.setRGB(w, h,(int)color);   
              }
          }
          //save im into a file 
          frame.setFilteredImage(Resizer.resize(image, panelHeight, panelWidth));
  </code></pre>
  
  <p>frame has url of my image. I get it using <code>frame.getURL()</code></p>
  
  <p>And in result I want to see my image with blur filter but instead it gives me 
  <img src="https://i.stack.imgur.com/lkyGS.jpg" alt="enter image description here"></p>
  
  <p>So may be someone know where I make a mistake???</p>
  
  <p>Or may be you know another good way to set filter using such matrix</p>