import groovy.swing.j2d.*
def gr = new GraphicsRenderer()
gr.renderToFile("sample1142a.png", 200, 200){
  antialias("on")
  rect( x: 0, y: 0, width: 200, height: 200,
    borderColor: no){
    texturePaint(x: 0, y: 0, file: 'sf.jpg' )
    filters {
      grayscale()
      // numColorsは8から256
      // see com.jhlabs.image.QuantizeFilter.
      quantize(numColors: 8)
    }
  }
}
元画像(sf.jpg)
出力画像(sample1142a.png)
 
 
No comments:
Post a Comment