Skip to content

add crop feature#376

Open
mbkma wants to merge 1 commit into
masterfrom
crop
Open

add crop feature#376
mbkma wants to merge 1 commit into
masterfrom
crop

Conversation

@mbkma

@mbkma mbkma commented Mar 14, 2026

Copy link
Copy Markdown
Member
Screenshot at 2026-03-14 15-36-42

Fix #59

@mbkma mbkma requested a review from a team March 15, 2026 20:03

@vkareh vkareh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic work! It doesn't yet work for me entirely for some reason, but it's looking good so far.

Comment thread src/eom-scroll-view.c
zoom = 1.0;
break;

case GDK_KEY_Escape:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also make the Enter key apply the crop?

Comment thread src/eom-window.c
GtkAction *action_undo, *action_save;

eom_image_crop (image, x, y, width, height);
eom_image_modified (image);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is working for me - the image is not marked as modified, so even if I click Save, the image just goes back to the original...

Comment thread src/eom-image.c
priv->image = cropped;
priv->width = width;
priv->height = height;
priv->modified = TRUE;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you should call eom_image_update_exif_data (same as eom_image_real_transform)

Comment thread src/eom-scroll-view.h

void (* zoom_changed) (EomScrollView *view, double zoom);
void (* zoom_changed) (EomScrollView *view, double zoom);
void (* crop_requested) (EomScrollView *view, gint x, gint y, gint width, gint height);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will force an ABI change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it's not mandatory, especially as this is not actually used in the class implementation

Comment thread src/eom-scroll-view.c
Comment on lines +1802 to +1805
priv->has_crop_rect = FALSE;
priv->crop_drawing = FALSE;
priv->crop_active_handle = CROP_HANDLE_NONE;
priv->crop_moving = FALSE;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are all the same in both condition branches, move them out

@mbkma

mbkma commented Mar 17, 2026

Copy link
Copy Markdown
Member Author

This is fantastic work! It doesn't yet work for me entirely for some reason, but it's looking good so far.

you have to click inside the drawn rectangle to crop

@vkareh

vkareh commented Mar 17, 2026

Copy link
Copy Markdown
Member

you have to click inside the drawn rectangle to crop

Yes, that worked, and it crops it, but I cannot save the image. If I try to save it, I get a banner that says The image "whatever.jpg" has been modified by an external application. Would you like to reload it? and two buttons: Reload and Hide. The cropped image never saves to disk.

The other issue is that the cropping rectangle only shows up when I release the mouse, so I don't actually see the rectangle until then.

@mbkma

mbkma commented Mar 17, 2026

Copy link
Copy Markdown
Member Author

you have to click inside the drawn rectangle to crop

Yes, that worked, and it crops it, but I cannot save the image. If I try to save it, I get a banner that says The image "whatever.jpg" has been modified by an external application. Would you like to reload it? and two buttons: Reload and Hide. The cropped image never saves to disk.

The other issue is that the cropping rectangle only shows up when I release the mouse, so I don't actually see the rectangle until then.

Ok, that is strange. I do not get any of those issues. I will look into it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Crop Image feature in Eye of MATE

3 participants