flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
24.58k stars 1.58k forks source link

[Feature request] New tool to trim the selected area if it has same color background. #1490

Open mmahmoudian opened 3 years ago

mmahmoudian commented 3 years ago

The issue

I generally use Flameshot to copy some graphs and figures and I have to spend quite some time to move the selection area to trim the extra blank area.

The proposed solution

Having a feature to trim the selected regions to the minimum if the background is from the same color. The following is an example I quickly made:

image

Caveats

If there is a subtle color gradient or difference it will not be trimmed and the user might get frustrated.

holazt commented 3 years ago

@mmahmoudian I don't think we need to add another tool, it was actually implemented on the opencv branch a long time ago, and that is the active window detection, it will automatically trim the selected area.

mmahmoudian commented 3 years ago

But shouldn't active windows detection somehow query the Window Manager instead of trying to do image processing? For example in case of tiling WM such image processing would fail.

Regarding my suggestion, some hours ago I had an idea of passing the raw screenshot to imagemagic and use that to trim the white space. I'll try it today and if it work I'll probably retract my feature request.

mmahmoudian commented 3 years ago

I managed to put together the following:

flameshot gui -r | convert png:- -trim png:- | xclip -selection clipboard -t image/png

This assumes you have the following installed:

Update: I created a small script to perform this and few other image manipulations from a dmenu: https://codeberg.org/mehrad/dmenu_shot/

2021-04-29_15-04


@ZetaoYang @borgmanJeremy @thepurple

Do you think it has merit to keep this feature request or it should be closed?

daneel6672 commented 3 years ago

I'd definitely like this feature as I have to do this trimming manually all the time (have a gimp window open, paste to gimp, crop and export). A single shortcut should really be able to do this e.g. Snagit has it but I don't use Windows, Shutter had it but is unsupported now. That's because this is a common use case.

veracioux commented 2 years ago

An interesting variant of this would be to make the selection snap to the area that we want trimmed to. So, when you are moving an edge of the selection close to an edge of the trimmed area, the selection would snap to that edge.

Not saying that I would like this implemented, just giving some food for thought.

edmundlaugasson commented 1 month ago

Please allow also manually crop. Sometimes it is needed to do it manually, e.g. keep a bit more free edge and not crop too closely to content. Would propose to allow to configure crop tool - either manual or automatic. At the same time while not yet finalize screenshot, we can change area edges and in that sense we already have Crop functionality.