flameshot-org / flameshot

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

Color subtraction #1482

Open funnym0nk3y opened 3 years ago

funnym0nk3y commented 3 years ago

Hey,

I really like using flameshot. But when copying stuff from my lecture notes, some of them have a background color, mostly to indicate something. It would be very nice, if there was an option to replace/subtract a color with another color.

e.g. grafik 2021-03-16 14 48 31

borgmanJeremy commented 3 years ago

In my opinion this should be done in another tool like GIMP since it exceeds the scope of simple edits. But if the community feels otherwise we can add it.

My concerns are:

  1. It won't tie in very nicely with the simple annotation tools since it needs multiple settings (color to select, and color to replace with).
  2. Do we need to support fuzzy matching?

@mmahmoudian what are your thoughts?

mmahmoudian commented 3 years ago

It is a cool feature, but I believe that this is slightly out of the scope of a screenshot tool. The biggest issue I see is other than the 2nd point of @borgmanJeremy is that we the have to get down to the rabbit hole of keeping the shadows or not and what is a proper threshold and etc. and if color matching should be continues or not. Even in Gimp/Krita/Photoshop this takes some efforts to get it right.

Perhaps this can be facilitated when/if we have the SVG output as then it more encourage user to use a proper photo-editing tool.

Might also be a nice to have @ZetaoYang and @thepurple opinions.

panpuchkov commented 3 years ago

From a first sight it looks interesting, but... It's not a "Photoshop" and shouldn't be. What we shouldn't forget is to keep interface simple and do not make it overloaded with a huge number of buttons. Possibly we need to rethink its concept and make it more flexible and not overloaded at the same time. Maybe add some kind of ComboBox. We already have a lot of buttons and I have a number of complaints from our team members for too overloaded interface and "jumping" buttons on small screenshots. I don't want to add anything more to current interface if it's not a killer feature. I know, that we can hide buttons, but users usually don't want to do it.

funnym0nk3y commented 3 years ago

I thought about your concerns too. It's true, that this is a feature which needs some tweaking for perfect results. Especially for pictures with a lot of detail. And thus adds complexity to the UI. But let me explain why I think it fits to flameshot nevertheless (at least in my usecase):

Some basic tweaking options could be integrated in the color menu (I don't know the name, the one that pops up on the left).

holazt commented 3 years ago

From a first sight it looks interesting, but... It's not a "Photoshop" and shouldn't be. What we shouldn't forget is to keep interface simple and do not make it overloaded with a huge number of buttons. Possibly we need to rethink its concept and make it more flexible and not overloaded at the same time. Maybe add some kind of ComboBox. We already have a lot of buttons and I have a number of complaints from our team members for too overloaded interface and "jumping" buttons on small screenshots. I don't want to add anything more to current interface if it's not a killer feature. I know, that we can hide buttons, but users usually don't want to do it.

It's possible to improve the response speed of capturing by automatically reloading dlls periodically.

mmahmoudian commented 3 years ago

@funnym0nk3y I just made the following for myself and mapped it to a keyboard shortcut. It let you select the region, then it passes it to ImageMagic to remove the "white" background color and make it transparent and then passes it to xclip which puts it in clipboard as PNG:

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

You can also add -fuzz X% where X is the tolerance for the "white" color.

This is the result of my command when replacing the white with that yellow:

flameshot gui -r | convert png:- -trim -transparent \#fff7ab png:- | xclip -selection clipboard -t image/png

image

kpcee commented 3 years ago

Lately there are more and more suggestions for functions that are so specific that hardly anyone will use them. For such special functions a kind of plugin interface could be created that can manage and execute shell scripts. Scripts that can change the images via external programs like ImageMagick. This way you could enable special effects like watermarks, shadow effects, black and white photos ... Otherwise, Flameshot essentially already offers all the necessary functions to edit screenshots well and should be oriented to other programs such as Shutter.

In my opinion, it would make much more sense in optimizing the existing functions and the GUI. The ever-changing interface by self-arranging buttons are just one possibility. The settings dialog could also be clearer and in Shutter it's possible to load images and make changes whenever you want and objects can be modified in position and size, not only undo and redo. There is still a lot of room for improvement, but any special effects that only make the program unnecessarily complicated and bloated, I would refrain. Just my opinion.

nom3ad commented 3 years ago

@funnym0nk3y I just made the following for myself and mapped it to a keyboard shortcut. It let you select the region, then it passes it to ImageMagic to remove the "white" background color and make it transparent and then passes it to xclip which puts it in clipboard as PNG:

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

You can also add -fuzz X% where X is the tolerance for the "white" color.

This is the result of my command when replacing the white with that yellow:

flameshot gui -r | convert png:- -trim -transparent \#fff7ab png:- | xclip -selection clipboard -t image/png

image

Is it possible to define custom command action buttons? That would be really cool I guess. Users can easily extend functionalities using external scripts.

mmahmoudian commented 3 years ago

@nom3ad No, you cannot define custom actions for buttons inside Flameshot, but you can (as I demonstrated) use Flameshot in your scripts and trigger them using keyboard shortcuts. For example for me the Ctrl Shift Prntscrn triggers this command that I shared here to remove white background.

There has been some discussions about extensibility of Flameshot and add a plug-in system but it s still in early phases and we haven't decided to add it or not.