Announcement Announcement Module
Collapse
No announcement yet.
How to get the image size (width and height)? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get the image size (width and height)?

    Hi, I am new to grails. I spent fare amount of time in search of finding the image size using grails but end up with nothing.
    I want to find the image size (width and height) using grails by just giving path of the image. Is it possible using grails? if yes, how?
    Please suggest me easy way to find the image size.

    Thanks in advance,
    Venkatesh

  • #2
    Any help is appreciated...

    Comment


    • #3
      What image size? Is this a static resource under web-app/images of the application? Or is it an image upload? Or is it an image elsewhere? Regardless, you should have a look at the Burning Image plugin, which I believe makes it pretty easy to access this information.

      Comment


      • #4
        thanks for your reply.
        Ya it is a static resource under web-app/images of the application.
        I found the solution as well, it is as shown below -

        import java.awt.image.BufferedImage;
        import java.io.File;
        import javax.imageio.ImageIO;
        ...

        def img = ImageIO.read(new File("path/to/your/file/cherry.jpg"));
        println("Width:"+img.getWidth()+" Height:"+img.getHeight());

        I think it is too late response from the forum.

        Regards,
        Venkatesh

        Comment

        Working...
        X