Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 80925

Get Image Dimesions - Help

$
0
0

Hi Guys,

Wondered if you could help with a custom java action. I want to create a custom java action to get the properties of an image (height and width), the overall goal is find out if its landscape or portrait (by looking at which length is greater in size), then setting the smallest length (if it isn't smaller then 900, to 900, then keeping the ratio of the other length). This is in an effort to compress the size of a stored image.

 

I can change the length because there is already something in the app store which can resize image, but i need the current image properties to idenifty if its a portait or landscape, then to keep the ratio when i reduce the size. I don't write java but have got as far as:

    // BEGIN USER CODE
        BufferedImage inputImage = ImageIO.read(new File(filename)); 
        int width =  inputImage. getWidth(); 
        int height = inputImage.getHeight();
        // END USER CODE

 

But this returns an error of:

ava.lang.Error: Unresolved compilation problems: 
    BufferedImage cannot be resolved to a type
    ImageIO cannot be resolved
    File cannot be resolved to a type
    filename cannot be resolved to a variable

 

Any help is greatly appreciated!


Viewing all articles
Browse latest Browse all 80925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>