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

Work around jpegtran to get correct rotated crops. #82

Merged
merged 1 commit into from
Nov 12, 2020

Conversation

ConradHughes
Copy link
Collaborator

@ConradHughes ConradHughes commented Nov 12, 2020

Hi Jeff, so — seem to have cracked this without modifying libjpeg-turbo: even though jpegtran doesn't seem to quite understand what it's doing, using an additional 'f' specifier on dimensions in the crop strings allows production of correctly sized rotated cropped images that (over a few manual tests) are identical to what you can produce using a pipeline of '-perfect' invocations of jpegtran. This minor change means cropgtk supports the full range of behaviour that you'd expect from the standard: no matter how the input image is rotated, perfect and correctly-sized outputs are generated with ICMU-aligned top-left corners and arbitrary bottom right corners. Yay!

Thanks again..

@ConradHughes
Copy link
Collaborator Author

ConradHughes commented Nov 12, 2020

Notes for future changelog:

* Add key controls:
  - q to quit
  - n for next image
  - s to save current crop but remain on this image
* Improved output filename handling (particularly for 's' above).
* Overwrite confirmation.
* Correct crop edge rounding vs rotation.

Copy link
Owner

@jepler jepler left a comment

Choose a reason for hiding this comment

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

Thanks! Are you interested in having collaborator access on this repo?

@jepler jepler merged commit ec36625 into jepler:master Nov 12, 2020
@ConradHughes
Copy link
Collaborator Author

Are you interested in having collaborator access on this repo?

Sure, thanks — I've largely scratched my itch with these patches, but I use cropgui all the time, so am certainly up for helping keep it going if I can..

@howff
Copy link

howff commented Nov 30, 2020

You mention cropgtk -- does the non-GTK gui need to be modified as well?

Also I notice some calls to thumbnail.thumbnail((drag.w/scale, drag.h/scale)) use only a single slash, should they use a double slash for python3 to get correct divide behaviour?

@ConradHughes
Copy link
Collaborator Author

Hi Howff, interesting question. On my machine the GTK one is what gets installed, so I'm unfamiliar with the non-GTK one. Not sure whether the control loop I modified is GTK only, but I suspect it is. I'll try to take a look at this, and at the thumbnail issue..

I also owe a bug fix, as the latest master misbehaves when invoked on non-JPG images due to jpegtran-specific switches.

@howff
Copy link

howff commented Nov 30, 2020 via email

@howff
Copy link

howff commented Dec 16, 2020

Is ConradHughes getting committer access to approve pull requests?

@ConradHughes
Copy link
Collaborator Author

Hi Howff, I believe I have permission to do that — I'm sorry I've not got around to looking at your pull request yet, and thank you very much for submitting it! It's high on my to-do list now (I'm sure I'm at least as annoyed by the bug as you are) but the last couple of weeks have been a bit hectic.

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.

3 participants