Results 1 to 4 of 4
Thread: Image cropping
- 06-23-2010, 08:14 AM #1
Member
- Join Date
- Jun 2010
- Posts
- 7
- Rep Power
- 0
Image cropping
Hi All,
I want to cut a particular shape of an image in java, for example an image which contains a man with white background, here I want to crop the man without the background. Don't want to make it as transparent image, want to cut with some coordinates. I think using the cropImageFilter we can only cut the rectangle region. Can anyone tel me how to do this?
Thanks is advance.
- 06-23-2010, 12:52 PM #2
I don't know that you can have a none rectangular image. You want to have a polygon?Don't want to make it as transparent image, want to cut with some coordinates
What's wrong with using transparent pixels for the jagged spots?
- 06-23-2010, 01:12 PM #3
Member
- Join Date
- Jun 2010
- Posts
- 7
- Rep Power
- 0
- 06-23-2010, 03:32 PM #4
Member
- Join Date
- Jun 2010
- Posts
- 28
- Rep Power
- 0
1) Create a cropped BufferedImage of type INT_RGBA or 4BYTE_ABGR. All the pixels in this new image will already be transparent black.
2) Get a graphics object from this new BufferedImage and set the graphic's clip to the shape in question. You will have to translate the shape to the coordinate space of the new image.
3) Draw the old image onto the new image.
4) Dispose of graphics object.
You can also achieve a near identical effect using just the original image if that image allows for alpha values. It just wont be cropped.
Similar Threads
-
Problems drawing a section of an image onto another image.
By Cain in forum Java 2DReplies: 1Last Post: 04-17-2009, 12:44 AM -
[SOLVED] manipulating the pixel values of an image and constructinf a new image from
By sruthi_2009 in forum AWT / SwingReplies: 14Last Post: 04-10-2009, 08:46 AM -
Image cropping in Jsf on the release of mouse
By HarshalAuro in forum JavaServer Faces (JSF)Replies: 0Last Post: 11-12-2008, 06:24 PM -
Canvas Image popups another image (SWT)
By SpaceY in forum New To JavaReplies: 2Last Post: 11-11-2008, 01:25 PM -
Converting multiple banded image into single banded image... Image enhancement
By archanajathan in forum Advanced JavaReplies: 0Last Post: 01-08-2008, 05:29 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks