vimiv-qt
vimiv-qt copied to clipboard
Cropping of images
A nice widget to crop images without the use of external commands would be nice to have.
I enjoy using Vimiv and as a photographer, Darktable and Gimp do my job in extensive editing needs. On the other hand, for simple editing, I use cropping and compression with the -resize or -quality parameters with the "convert" command in the terminal.
For this improvement, if we can give simple Imagemagick commands via Vimiv :!convert parameters, we can manage many simple editing operations visually. Or a shell command like Ranger might work.
Calling shell commands should absolutely be possible, I am just not sure how well this works in case you actualy would like to select a crop region.
Have you tried something along:
:!convert -whatever -arguments -you -need % output.jpg
Note that %
is expanded to the name of the current file. Some more information is available in the command line documentation.
If you require an actual sub-shell, e.g. for pipes, use :spawn
instead of :!
.
What I would like here is an actual crop widget which you can drag, resize and so forth in the UI. So basically this, just without the remaining bugs :smile:
On my first attempt, I skipped putting output.jpg to the end. So I got an error. I thought I would overwrite the same file and also forgot to put % i guess.
Now it simply meets my request when I run it as follows.
:!convert % -resize 900 -quality 75 output.jpg
It will be very useful for me as there are numerous options available with "convert". Still, if the crop widget feature you specified is added, it is a good improvement.
With this little advice, you made an important addition to the program for me. :) In Vimiv documents, it would be good to state that :!convert command can be used. I hope it will be useful for others.
Thanks for taking time for quick replies. Best.
If I remember imagemagick correctly, you would overwrite the same file using mogrify
instead of convert
, so your command would read:
:!mogrify -resize 900 -quality 75 %
I am not quite sure how you would update the documentation, just add more examples with convert like the one covering gimp? If you like, you could also add some examples useful to you to docs/documentation/getting_started.rst
in the form of:
Examples:
* ``:!gimp %`` opens the currently selected image in gimp.
* ``:!convert % -option -other output.jpg`` does something with the current image and
saves it to ``output.jpg``.
and open a PR :)
+1 for this!
By the way, if we had an option to show the X;Y coordinates of the image where the mouse cursor is in the statusbar, we could use it as a reference in the convert
command. It also would be a step towards the cropping feature.
While the actual crop widget is definitely out of scope for the time being, as our manpower is quite limited and there are quite some other things to work on first (c.f. #560), a simple statusbar module could be quick enough to fit in :blush:
I did a very rough first implementation in the cursor-position branch. To show the coordinates, one has to add the {cursor-position}
module to the statusbar as usual, e.g. just in image mode. @Yutsuten do you think you could give this a quick test if it already helps? Just let me know if you need additional help running this. I would then probably do some cleaning and merge it in :blush:
Concerning the actual crop widget, a lot of work happened (3 years ago :joy:) in the crop branch, but this never quite made it in due to some bugs in corner-cases. I do not recall what these were exactly, but suspect crop + zoom not playing well in the old state. If someone would like to pick this up, stabilize the issues, and open a PR, this would of course have a much larger chance of getting in :blush:
Oh nice @karlch , I'll take a look at that for sure!!
I tested it here! It is exactly what I was thinking about!! :+1:
Thanks for the quick test, at least the statusbar module is merged into master :partying_face:
Concerning the actual crop widget, (...) If someone would like to pick this up, stabilize the issues, and open a PR, this would of course have a much larger chance of getting in
It is hard to make promises as I'm very busy too, but I can give it a try!
It is hard to make promises as I'm very busy too, but I can give it a try!
That would be really helpful, but don't feel pressured of course, only if you have the time! :blush: What could already help is rebasing the old branch onto the current master and giving it a detailed test, noting down what the issues are / how the user feel is, as a starting point.