Search code examples
htmlcssgimp

Automatically crop the object to minimal size/resolution in GIMP


I am the absolute beginner in this subject.

When I have some object in GIMP and his background is transparent, may I automatically crop the object to minimal size/resolution?

I do this manually, that means I select the object, but this is not exact.

It is still a little different, but this unsatisfying me, because when I have this image with object on my website (example dog with transparent background, 150x150) and I have other image on my website (example cat with transparent background, 155x155) and I set some attributes him, but in one .class, because do setting #id each image is impossible.


Solution

  • See Layer>Autocrop layer and Image>Autocrop image.

    Note that in both cases, Gimp removes lines of strictly identical pixels, and this includes their opacity. So if you have even one single pixel which is faintly opaque, the auto-cropping will stop on it. In particular, non-rectangular shapes with a smooth contour have edges made of partially opaque pixels, so you may mistakenly think that the autocrop has missed out some space. This won't be the case.