gabm / Satty

Satty - Modern Screenshot Annotation. A tool inspired by Swappy and Flameshot.
Mozilla Public License 2.0
385 stars 18 forks source link

[FEATURE] Resizing the output #74

Open Heyian opened 2 months ago

Heyian commented 2 months ago

Hi, first of all, thanks for this tool, it's really amazing!

The only thing that i missing for me is an ability to set a resize value in the config and/or in the command. I'm not 100% sure what would be the best approach so let me explain my workflow a little bit.

In my line of work, I use screenshots a lot to make documentation. I usually make documentations for normies and screenshots are really the way to go to help themnavigate through an app. When I write documentation, I use a template so all my documentation look alike and I'm mostly using a 2 columns document. The column on the left has a screenshot with arrows, annotations and labels and the column on the right has all the text describing what the user see and what he can do in the window showed on the left side. As you can expect, having a fixed sized image is a must in this kind of workflow.

I'm using Hyprland, loving it, and right now I've bind a couple of keys to pipe grimblast into Satty, it's working really well. What I'd like to do is to bind another key (Shift-Print in my case) to load a different config of Satty to resize the file to 300x300 pixels before saving the output.

First, we would obviously need to implement resizing in Satty and I'm not sure how much work that would be...

Second, I currently see 2 ways to implement this if we manage to get this in Satty

  1. Have a new command --resize and set the number of pixels for the output. We could also implement it via % of initial file as I've seen in many places but in my case, I really need fixed resolutions to fit everything in my columns for the docs. This value could be set in the command line and could also be set in the config file. In this case, I would simply have 2 config files and I would call the right one with the right binding.

  2. Set a --doc command to output both files, original and resized one in the chosen folder. This way we wouldn't have the need to have 2 separate config files.

I'm not used to Rust so I don't think I'll be of much help, but if you're in need, I'm always willing to learn, we just won't have this soon ;)

gabm commented 2 months ago

honestly, I don't see that resizing the output image is a satty thing.. I think Satty should process and output the image in the same quality (ideally) and resolution (if not cropped) as it was supplied by the user.

That being said: I think you can do this quite easily with some shell scripting using ImageMagick. The internet is full tutorials like this one: https://www.digitalocean.com/community/tutorials/workflow-resizing-images-with-imagemagick

So the only thing that is required to make that work is that Satty outputs the image to stdout.. that is not yet implemented unfortunately but should be doable...

Heyian commented 2 months ago

That would perfectly fit my need indeed, I agree that it doesn't have to be done by Satty, it will prevent it from being bloated. I'll keep an eye out to see if you ever manage to get the output to stdout. Thanks for replying.

00-kat commented 2 months ago

Found a workaround for now, although it's not the best:

grim - | satty -f - && wl-paste | yourcommand

Unfortunately, --output-filename /dev/stdout results in a notification saying that the filename doesnt end in .png, so utilising the clipboard is the best I could think of.

Example:

grim - | satty -f - && wl-paste | magick convert - -channel RGB -negate - | chafa

Of course, outputting to stdout would still be preferable, but this can be used in the meantime.