bufferedimage

How do I show a BufferedImage image in a JFrame window?

There is an image image of the BufferedImage type. You need to display it in the window type JFrame.

java.awt.image.RasterFormatException: (y + height) is outside of Raster

I want to crop the image and get a square image. Example: Original image: 1000x667 I want to get: 667x667 From such an ima ... Exception: (y + height) is outside of Raster I know that the error occurs in this line image = image.getSubimage(x,y,w,h);