0

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 I want to remove the "canvas" area and be left only with the actual image.

Cheers

sksamuel
  • 16,154
  • 8
  • 60
  • 108

1 Answers1

3

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.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • 1
    Sorry to be a pest about it but is it possible to send an example about using LookupTable and LookupOp in this manner? Tried to do it but I guess I'm not doing something right. – zoran.nikolovski Aug 23 '10 at 23:29