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

Add image Crop functionality #1339

Open
6 tasks
IT-Tool opened this issue Apr 23, 2024 · 7 comments
Open
6 tasks

Add image Crop functionality #1339

IT-Tool opened this issue Apr 23, 2024 · 7 comments

Comments

@IT-Tool
Copy link

IT-Tool commented Apr 23, 2024

Setup (please complete the following information):

  • Geeqie version [2.4 GTK3]:

Feature request description
First of all, thank you for creating and maintaining this great image viewer application.

I wanted to suggest an enhancement that I think would make the application even more useful: the addition of a crop feature.

Currently, the application allows viewing images but doesn't have the ability to crop them. Having a built-in Crop tool would allow users to easily trim unwanted parts from images without needing to use an external editor.

Some suggestions for the cropping feature:

  • 1. Allow drawing a rectangle to define the cropping area
  • 2. Support aspect ratio presets for cropping (like 1:1, 3:2, 4:3, 16:9)
  • 3. Zoom in or out (while selecting an area to crop)
  • 4. Rotate the image left or right to align the crop.
  • 5. Allow an Undo action or Reset button to return to the original image operation (to undo selection of an area, undo image rotation or zoom)
  • 6. Provide "Apply" and "Cancel" buttons

When the user is in full-screen mode, it would be nice to be able to access the crop function by right-clicking (on any part of the image) or by using hotkeys.

Additional context
Screenshot example

Thank you for considering this suggestion!

@caclark
Copy link
Collaborator

caclark commented Apr 24, 2024

A basic image crop is available in the current release:

Select Edit/Draw Rectangle
Use the left-mouse button to drag a rectangle.
Select Plugins/Image Crop

A new image is created in /tmp. You can use the new image pop-up menu item Go To Directory View to view in a layout window.

You can use the standard zoom functions to zoom the image, but the rectangle remains the same dimensions. Maybe you want the rectangle to zoom also - but that may be irrelevant as you cannot adjust the rectangle..

This feature works in fullscreen. However, when you use mouse right-click to bring up the pop-up menu and select the Image Crop plugin, the rectangle disappears - but the cropped image is nevertheless created.

You cannot adjust the rectangle in any way. If it is not as you wish, you must redraw.

The plugin requires ImageMagick and exiftool to be installed.

@IT-Tool
Copy link
Author

IT-Tool commented Apr 25, 2024

@caclark Thank you for the explanation, I tried it and it does work as you described!

If I may, I would like to share my experience of using it:

  1. Firstly, this is a very non-obvious way to accomplish this task.
  2. Secondly, it is too basic but it could be improved to offer greater comfort.

It's nice that user can assign additional keys to the mouse to speed up this process:

2024-04-25_035456

I'd like to understand another things:

  1. What if I don't need to create a new image (after cropping), but I need to save over the original file. I'm curious to know how to do that. :)
  2. I've noticed that when in full screen mode, cropping images doesn't seem to be working. Additionally, it seems that the mouse pointer isn't visible.

I wonder if there might be a way to improve the user experience in this regard.

@caclark
Copy link
Collaborator

caclark commented Apr 27, 2024

I've noticed that when in full screen mode, cropping images doesn't seem to be working. Additionally, it seems that the mouse pointer isn't visible.

If you double-click on the main image, the cursor is not displayed. If you double-click on a thumbnail, the cursor is displayed with a three second timeout on cursor movement. If you use keystroke "F", it depends on your previous action.

This seems to be yet another bug.

@mowgli mowgli closed this as completed in a7ea378 May 22, 2024
@caclark caclark reopened this May 22, 2024
@caclark
Copy link
Collaborator

caclark commented May 22, 2024

What if I don't need to create a new image (after cropping), but I need to save over the original file. I'm curious to know how to do that. :)

That sound a little dangerous to me - but I am a bit careless. Therefore I do not think it would be a good idea to include it as a standard feature.

However, you can edit the Image Crop plugin to work as you wish.
Copy the shell script /usr/local/lib/geeqie/geeqie-image-crop to your user area
Edit the image crop .desktop file to point to the shell script in your user area
Edit the shell script to include something like:
cp $tmpdir/$filename-crop.$extension $1

There is no way back from that point....

@caclark
Copy link
Collaborator

caclark commented May 22, 2024

  1. Rotate the image left or right to align the crop.

I suggest that you use gimp to rotate the image to the required orientation and save it to a temporary file. But if you are using gimp, you might as well use that to crop the image.

@sventor
Copy link

sventor commented Nov 24, 2024

... strongly seconded.

The "crop" plugin window (after cropping) does not allow to return the cropped image back into geeqie, not even as a new image (file), lest as the (then changed) original, even if you want to overwrite it.

If cropping would going to be included in the main app, there would be no need to "cp -p ${tmpdir}/${filename-crop}.${extension} $1 back to the CWD.

If the developer(s) intend to do it the "integrated" way: would there be an option possible to slightly change the drawn selection rectangle? Other programs have "handles" around the rectangular selection with which you can fine-tune the area to crop...

Thanks!

@caclark
Copy link
Collaborator

caclark commented Nov 24, 2024

The "crop" plugin window (after cropping) does not allow to return the cropped image back into geeqie,

If you right-click on the cropped image, there is a menu option to got to directory view. From there you can copy the image.
[There is a bug in the latest sources. This action will cause Geeqie to crash]

If cropping would going to be included in the main app, there would be no need to "cp -p ${tmpdir}/${filename-crop}.${extension} $1 back to the CWD.

I am still a bit unenthusiastic about including image crop into the source.

The tedious way to fix the overwrite-original problem yourself is (as above):
cp /usr/local/lib/geeqie/geeqie-image-crop $HOME/scripts

Replace:
geeqie --view="$tmpdir/$filename-crop.$extension
with:
cp "$1" "$1.original.$extension"
cp "$tmpdir/$filename-crop.$extension" "$1"

Go to Edit/Configure Plugins and set the image crop plugin to point to your modified script.

Maybe I could change the script to have a "Overwrite Original File" option - but someone is going to click that accidentally.

would there be an option possible to slightly change the drawn selection rectangle?

Maybe, but unfortunately unlikely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants