Say I have this kind of image:

orig

You can see the black areas are separated by transparent pixels. If I want to extract these into new images, I could select the area, copy, create new image from clipboard. That works, but is pretty slow when I have 50 areas on the image. Not to mention, error prone due to snappy selection.

rectangle circle

Is there a way to do this easily in GIMP or any other editor? Is there a technical term for this image processing?

The way I would go about this in GIMP:

  • Use the fuzzy select tool (magic wand) to select the shape you need
  • Go to Image > Crop to selection
  • Export (ctrl-shift-e)
  • Undo (ctrl-z), start over

This takes me about two seconds per shape. Of course, fuzzy select works best with flat object in a single colour. If you've got more complex forms, it might be a bit harder to do.


Alternatively, if the images are aligned along a grid, you could use one of the methods described in this post.


EDIT: found a similar question over at superuser, seems the accepted answer over there is the one you're looking for if you really want to automate the whole thing.

It is also possible to do it in Photoshop using Slices. Basically you select the slice tool, drag a window on top of the areas you want to export, and use "Export to Web".

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.