Java: Crop out an area with specific color from an image
I was wondering if there is a way to crop out an area of an image with a specified color?
I have an image which is a canvas area with an actual image on it and开发者_StackOverflow社区 I want to remove the "canvas" area and be left only with the actual image.
Cheers
From this answer, if your image has a "distinct background color, use a LookupOp
with a four-component LookupTable that sets the alpha component to zero for colors that match the background."
Addendum: See also Using the Java 2D LookupOp Filter Class to Process Images and Image processing with Java 2D.
精彩评论