Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Crop To Content removing non-empty borders
#1
Shocked 
Hi,

About the function Layer ➤ Crop To Content it would be expected that only the empty areas (with transparency) would be removed from the layer and if there were no empty areas nothing would be changed.

Why then, in some cases, does the cut remove areas with content?

In the example below, only the crop to content filter was applied to images 01 and 02.
• Image 01
   
As seen in images 02 and 03, part of the content of these layers was removed leaving a transparent area.
• Image 02
   
• Image 03
   
Any configuration that I am losing and that is generating this unwanted result? A bug? What would be the explanation?

* Original image created by teapot in GC.

Thx
Reply
#2
Hello,

I think that is an intended behavior. According to this documentation, it "removes the [...] area around the outside edge which all has the same color". I assume that the color of the upper sky is a uniform blue.

I imagine that the original intent was to crop white area around an image.

I hope this helps you.
Reply
#3
See https://docs.gimp.org/en/gimp-layer-crop.html :

Quote:This command removes the largest possible area around the outside edge which all has the same color. It does this by scanning the layer along a horizontal line and a vertical line and cropping the layer as soon as it encounters a different color, whatever its transparency.

What you want to do looks more like Layer ➤ Transparency ➤ Alpha to selection followed by Layer ➤ Crop to content.
Reply
#4
(04-28-2021, 10:42 PM)Ofnuts Wrote: What you want to do looks more like Layer ➤ Transparency ➤ Alpha to selection  followed by Layer ➤ Crop to content.

Ohhh ... I have always interpreted and used this function in the wrong way!  Huh
The interesting thing is that it always seemed to work as desired.  Dodgy

Were it not for the fact that I had done an experiment with the image displayed in post #1 and noticed the difference in the expected result, my understanding of this procedure would remain wrong for a few more centuries.  Rolleyes

Fortunately, the reading suggested by you solved the issue.

However, the comment made by Ofnuts left me intrigued. This led me to an investigation into the option he suggested.

I ended up discovering a subtle difference responsible for my misinterpretation of this Crop To Content command.

In the image below there are two particular situations:
1-➤ The layer is not the same size as the image (canvas).
2-➤ The layer and the image (canvas) are the same size.

When the first situation occurs (possibly the reason for my confusion) it is possible to simply apply Crop to content directly.
This will do exactly the same as the steps indicated by Ofnuts, only more direct (less menus = Layer ➤ Transparency ➤ Alpha to selection  followed by Layer ➤ Crop to content)

However, if the situation is that of the second case, and the image has a homogeneous color border, it will be removed - Case of the image posted in post #1.

Applying Layer ➤ Transparency ➤ Alpha to selection followed by Layer ➤ Crop to content, in the two situations in the image below:
   

cli345 and Ofnuts, thank you very much for clarifying this doubt.
Reply


Forum Jump: