Currently working in Java, i’d like to be able to select part of an image using the mouse pointer co ordinates. The area selected then needs to be cut from the existing image and used to create a new separate image.
Just like a few pointers on how to go about it. Thanks.
If you want the user to be able to “click-and-drag” to select a rectangle you need to implement a
MouseMotionListener. Have a look at themouseDraggedmethod:When you need to get hold of the sub-image, you simply use
If you want to save the resulting image to disk, I suggest you have a look at Saving a Generated Graphic to a PNG or JPEG File.