No description, website, or topics provided.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
grails-app first commit Sep 16, 2011
src/groovy/org/groovydev fix: saving jpg files Oct 4, 2011
.classpath fix: saving jpg files Oct 4, 2011
.project first commit Sep 16, 2011
ImageBuilderGrailsPlugin.groovy fix: saving jpg files Oct 4, 2011 first commit Sep 16, 2011

A simple image builder grails plugin

Example: How to create square 50px50p and 20px20p tumbnail images.

    def b = new org.groovydev.SimpleImageBuilder()
    b.render(width:'100px',height:'100px') {
       def small
       image(file:'image.jpg') {
         small = fit(width:100,height:100)
       draw(align:'center', image:small)
       fit(width:50,height:50) {
         save(file:'thumbnail-50p.png', format:'png')
       fit(width:20,height:20) {
         save(file:'thumbnail-20p.png', format:'png')
         save(file:'thumbnail-20p.jpg', format:'jpg', bgcolor: '00ff00')


  render(width, height)            - render image
  draw(align,offsetX, offsetY,image) - draw image
  image(file|url|stream)           - load image

  save(file|stream,format,[bgcolor],[image]) - save image
  * format - png, jpg
  * bgcolor (optional, default is white) - Save jpg file use the background color to paint under the non-opaque portions of the image.

  scale(width,height)              - height is optional(use width) e.g: scale(50%) == scale(50%,50%)
  fit(width,height)                - relative scale the image until if fits (default as scale)
                                     bounds of the given box
  rotate(degrees,x,y)              - the rotation position x and y are optional (default is 50%)
  fill(color)                      - fill with color
  margin(left,top,right,bottom)    - add margins to image (resize image canvas)


  • values ending with '%' means size relative to image size.
  • values ending with 'px' means values in absolute pixels.
  • values without postfix use default notation.