开发者

How to find if image in landscape or portrait orientation in Java?

Is there any method that shows if the image is in landscape orientation or not?

I have a file and I create a BufferedImage, but don't know what's the method for fin开发者_Go百科ding the orientation.


There are not method but the easiest way:

public boolean isLandscape(BufferedImage image){
  return image.getWidth() > image.getHeight();
}

You could put this method to some Utils class.


try this ....

  if (image.getIconWidth() > image.getIconHeight()) 
    {  result = 0;
     } else {
    result = 1;
    }


What about:

return (bi.getHeight () < bi.getWidth ());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜