1
I want to crop  image like below.


 +------------------+
 |                  |
 |  +-----------+   |
 |  |           |   |
 |  |           |   |
 |  |           |   |
 |  |           |   |
 |  +-----------+   |
 |                  |
 +------------------+


style="width: 413px; height: 296px; margin-left: -134px; margin-top: -67px;"

             var height = ele.css('height');
     var width = ele.css('width');
     var margin_left = ele.css('margin-left');
     var margin_top = ele.css('margin-top');

トリミングされた画像を取得するためにここで何をすべきかわかりませんか?

 final int totalheight = image.getHeight();  //1900
 final int totalwidth = image.getWidth();  //2533
       image.getSubimage(totalheight+Integer.valueOf(margintop).intValue(), totalwidth+Integer.valueOf(marginleft).intValue(), Integer.valueOf(width).intValue(),Integer.valueOf(height).intValue());


java.awt.image.RasterFormatException: (y + height) is outside of Raster
at sun.awt.image.ByteInterleavedRaster.createWritableChild(Unknown Source)
at java.awt.image.BufferedImage.getSubimage(Unknown Source)
4

1 に答える 1