Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cropping of images #8

Closed
karlch opened this issue Jan 13, 2018 · 11 comments
Closed

Cropping of images #8

karlch opened this issue Jan 13, 2018 · 11 comments
Labels
enhancement New feature or request help wanted

Comments

@karlch
Copy link
Owner

karlch commented Jan 13, 2018

A nice widget to crop images without the use of external commands would be nice to have.

See this issue of the GTK version.

@karlch karlch added enhancement New feature or request priority-low labels Jan 13, 2018
@karlch karlch mentioned this issue Nov 13, 2019
@eorus
Copy link

eorus commented Apr 22, 2020

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.

@karlch
Copy link
Owner Author

karlch commented Apr 22, 2020

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 😄

scrot-2020-04-22_12:37:33

@eorus
Copy link

eorus commented Apr 22, 2020

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.

@karlch
Copy link
Owner Author

karlch commented Apr 22, 2020

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 :)

@Yutsuten
Copy link
Contributor

Yutsuten commented Jan 9, 2023

+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.

@karlch
Copy link
Owner Author

karlch commented Jan 9, 2023

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 😊

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 😊

Concerning the actual crop widget, a lot of work happened (3 years ago 😂) 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 😊

@Yutsuten
Copy link
Contributor

Yutsuten commented Jan 9, 2023

Oh nice @karlch , I'll take a look at that for sure!!

@Yutsuten
Copy link
Contributor

Yutsuten commented Jan 9, 2023

I tested it here! It is exactly what I was thinking about!! 👍

@karlch
Copy link
Owner Author

karlch commented Jan 9, 2023

Thanks for the quick test, at least the statusbar module is merged into master 🥳

@Yutsuten
Copy link
Contributor

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!

@karlch
Copy link
Owner Author

karlch commented Jan 10, 2023

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! 😊 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.

@Yutsuten Yutsuten mentioned this issue Jan 11, 2023
2 tasks
@karlch karlch closed this as completed in df8a4a4 Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted
Projects
None yet
Development

No branches or pull requests

3 participants