Cropping: Why the Shaded Border?

The white rectangle for cropping is good, but why is there a shaded black border that obscures your view? Cropping demands precision & that makes it impossible to see. I always have to click off the filter to see what I’ve just done then readjust it a ton of times until it’s right…Does anyone know how to remove it? Thanks.

Hi @ackeyjopes

There is no setting in Shotcut to remove this black border.
But you can change one line of code in the Shotcut directory to do it.

Here’s the file path on Windows (could be different if you use another operating system):
C:\Program Files\Shotcut\share\shotcut\qml\modules\Shotcut\Controls

In the Controls folder, use a source code editor, like Notepad++ to open the RectangleControl.qml file, and edit line 166 (could be different on other operating system or Shotcut version)

Change:
item.enabled ? 0.4 : 0.2
to
item.enabled ? 0 : 0

Note that this will also remove this black border on any filter that uses a rectangle control. Like the Size, Position & Rotate filter for example.

Result:

2 Likes

Wow, how is every Windows user a computer genius?..Is it that things are so complicated on Windows that it requires you to essentially become a programmer to use it? Anyway, I definitely appreciate the help & that’s super impressive, but way over my head. Thank you though.

I’m not a programmer. I’m just curious and like to see how things work. Unlike many other programs, it’s easy to open Shotcut’s hood and change things if you want to.

It’s not that difficult. And anything you do is reversible. If you mess up and see errors after editing the code, just re-edit the line to its original state, or download and re-install Shotcut.

2 Likes

I know–I have a friend who also uses Windows & he frequently refers to “file paths”. It’s not something I’ve ever personally encountered on Mac. I mean, if you go into a folder, then subfolders within that folder, it will show you folder icons at the bottom that track the steps you took to get you where you are…but I don’t know anything outside of that (& again, that’s just me personally. I’m sure Mac has something similar. I’ve just never seen it). With regards to lines of code, they make me want to run away screaming…but again, definitely impressive. If I were that skilled, I’d probably use DaVinci Resolve or something. What I love about Shotcut is that it’s user-friendly for dummies like me.

1 Like

The border exists for the same reason people put outline or shadow in text in video—because it can’t assume the line will be visible against every color. For example, if your video or image has a white (or nearly so) background.

1 Like

Right, but shouldn’t the shading be outside of the cropping box rather than within it? That way you know: everything outside of this box will be cropped out…It took me a long time to even realize that the white line is the only one that matters, because it seems as though there are 2. Also, my vision isn’t so good, so maybe that’s why it’s especially difficult: all I see is black. It’s okay though. I appreciate your response…Thanks.

1 Like

@musicalbox, this is cool! Thank you. For ages I’ve been wondering if there was a way to remove the grey shading, because it sometimes gets in the way of cropping when accuracy is needed.
Your answer seems to solve it - but:

…good point @shotcut! I put a white colour clip over another white clip, cropped it, and of course, the boundary box disappeared!

So I got thinking - could the crop/SPR boundary box be made a colour - eg red, blue, yellow etc?

And I found out that it could, by simple changes to the RectangleControl.qml file - Lines 32 and optionally Line 166.

Please note, though, only try this if you are happy with changing the default code, and I suggest a backup of the file is made so you can revert to the defaults if required.

For information, the default lines 32 and 166 are:

Shotcut defaults:

 Line 32: property color handleColor: Qt.rgba(1, 1, 1, enabled ? 0.9 : 0.2)
 Line 166:border.color: Qt.rgba(0, 0, 0, item.enabled ? 0.4 : 0.2)

So - let’s change the boundary box and handles to RED.
The standard RGB values of red are (255, 0, 0) (I looked it up on Google)…
This equates to the values (1, 0, 0) in the RectangleControl.qml file.
(255 =1).

So, simply change Line 32 to:

 property color handleColor: Qt.rgba(1, 0, 0, enabled ? 1 : 1)

… and it will work. The 1:1 relates to the “alpha” (in RGBA (Red, Green, Blue, Alpha) and makes the red colour totally opaque (solid) - please note - I am not 100% sure whether this is the correct way of indicating zero transparency (fully solid colour) - perhaps @shotcut might confirm this if you have any time?)

You can change to any “100% colours”, aka “fully saturated colours” (ie those that have just combinations of 255 and 0), by replacing 255 with “1”. There are 8 of these:
100 per cent colours

White: RBG (0, 0, 0 ) = (0, 0, 0)
Black: RBG (255, 255,255) = (1, 1,1)

Red: RBG (255, 0, 0) = (1, 0,0)
Green: RBG (0, 255, 0) = (0, 1,0)
Blue: RBG (0, 0, 255) = (0, 0,1)

Magenta: RBG (255, 0, 255) = (1, 0,1)
Yellow: RBG (255, 255, 0 ) = (1, 1,0)
Cyan: (or Aqua) RBG (0, 255, 255,) = (0, 1,1)

I also found out you can make the boundary box ANY colour, by converting any RGB non-255 figures into percentages (out of 255) - so take HOT PINK for example.
The standard RGB of Hot Pink is (255, 105, 180). So as percentages out of 255,
here’s the calculation:
255 divided by 255 = 1;
105 divided by 255 = 0.4;
180 divided by 255 = 0.7.

So this line 32 in the code:

 Line 32: property color handleColor: Qt.rgba(1, 0.4, 0.7, enabled ? 1 : 1)

gives a HOT PINK boundary box - which I think is a good colour to choose which will hopefully show up on most images/videos/backgrounds.

In my videos, I often crop images of sheet music (white with black music) so this will make cropping easier for me personally.

I’m not suggesting that the original code should be changed - the current situation (white border box with black 0.4 transparency shading) is acceptable for most cropping/re-sizing tasks - it’s just an idea to show that users do have the option to change the colour if they wish.

2 Likes

Ooh, how about a nice Dodger Blue? :grin:
(Did you know that the Dodger Blue colour is named after the Los Angeles Dodgers baseball team’s uniform colour? True).

Standard RGB: (30, 144, 255),
so the equivalent numbers are:
(30/255 = 11.47%), (144/255 = 56.47%) (255/255 = 100%)
so the code line would be:

property color handleColor:Qt.rgba(0.1147, 0.5647, 1, enabled ? 1 : 1)  

2 Likes

Nice!
But that would be totally practical if some settings were added to Shotcut to choose our own custom colors for the rectangle control.

I’m thinking that a more universal way to solve the problem could be to simply reduce the opacity of the dark rectangle, instead of removing it completely (like I proposed above).

Default values
item.enabled ? 0.4 : 0.2

Completely transparent
item.enabled ? 0 : 0

Almost completely transparent
item.enabled ? 0.1 : 0.1

1 Like

I see what you’re saying, but I agree with genius #2, haha. Again, I would prefer it be done like Photos (on Mac) or Avidemux where all shading is outside of the box. That way you have a clear view of what the crop will be…but since the 3 of you keep insisting that there needs to be something inside the box, I prefer jonray’s approach, because that way, nothing’s obscured except some tiny square-sized areas.

2 Likes

I thought of that but didn’t have time to mention it. :wink:
Just to add that line 166 doesn’t have to be grey (to be precise, black with transparency) - you could make it say, Dodger blue set to 0.1 transparency:

border.color: Qt.rgba(0.1147, 0.5647, 1, enabled ? 0.1 : 0.1)

Which might be easier to see through:

I would second that as an option

LOL! Not insisting, just thinking of other ideas … :grin:

Thank you, sir!

2 Likes

Thanks, @ackeyjopes - I can live with that!! LOL! :sunglasses:

2 Likes

chrome_CgFuaIxiAj

The advantage of using two contrasting colors (e.g. white for the thin rectangle, and transparent black for the thicker rectangle) is that the rectangle selection stay visible no matter what color the background is.

Sorry to defend my argument a bit more… :wink:

With the black line at 0.1, 0.1 (or even at 0.2, 0.2 like I used in the clip below), you still clearly see every the details of the background. So it’s possible to make fine adjustments without any guessing.

1 Like

C’est facile, ligne 168 du fichier, mettez une valeur négative, par exemple

It’s easy, line 168 of the file, put a negative value, for example

anchors.margins: -10
2 Likes

Bonjour Namna !

Puisque vous êtes là, pourriez-vous expliquer à @ackeyjopes comment trouver le fichier en question sur son Mac. Il mentionne plus haut que c’est un peu au dessus de ses capacités. J’ai donné le chemin pour Windows, mais j’ignore comment procéder sur une Pomme :wink:

Since you’re here, could you explain to @ackeyjopes how to find the file in question on his Mac. He mentions above that it’s a bit beyond his capabilities. I’ve given the path for Windows, but I don’t know how to proceed on an Apple.

1 Like

Oh goodness, it works! Genius #3!!

Oh mon Dieu, ça marche ! Génie n°3 !!

2 Likes

La première valeur correspond à l’opacité lorsque le filtre est activé, la seconde lorsqu’il est inactif (lorsque la case devant son nom est décochée)
En mettant la seconde valeur à 0.0, il devient transparent, on ne le voit plus.
Dans certains cas, pour faire un ajustement précis, vous pouvez décocher la case. Bien sûr les poignées du VUI sont désactivées, mais les spinbox fonctionnent.

The first value corresponds to the opacity when the filter is activated, the second when it is inactive (when the box in front of its name is unchecked)
By setting the second value to 0.0, it becomes transparent, we can no longer see it.
In some cases, to make a precise adjustment, you can uncheck the box. Of course the VUI handles are disabled, but the spinboxes work.

2 Likes

Je me demandais pourquoi il y a 2 valeurs :slight_smile: Merci !
I was wondering why there are 2 values :slight_smile: Thank you!

1 Like