Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image resize in Grails

I am developing a Web Album using Grails and for image processing, I am using grails-image-tools plugin. I need a functionality to resize the images if the uploaded images size is too big (for eg: more than 600 * 840 ) . In this case I need to resize this image to 600 * 840). What is the most efficient way to do this? Thanks a lot.

like image 305
Omnipotent Avatar asked Dec 12 '08 10:12

Omnipotent


1 Answers

In BuildConfig.groovy add a dependency to imgscalr

dependencies {
    compile 'org.imgscalr:imgscalr-lib:4.1'     
}

Then resizing images becomes a one-liner:

BufferedImage thumbnail = Scalr.resize(image, 150);
like image 86
Dónal Avatar answered Oct 20 '22 19:10

Dónal