GNOME Bugzilla – Bug 339081
lossless JPEG-cropping
Last modified: 2018-07-12 00:09:53 UTC
The jpeg crop does not seem to be lossless. Lossless cropping of jpegs is possible to do for JPEGs like it is possible to do 90 degress rotation lossless. A description of the concept: http://www.impulseadventure.com/photo/lossless-rotation.html I used this program before (with wine): http://ekot.dk/programmer/JPEGCrops/ it is a GUI-frontend to jpegtran: http://sylvana.net/jpegcrop/ according to bug 338997 (jpegtran performance enhancement) f-spot used libjpegtran. I don't know if this version of (lib)jpegtran contains the patch that make lossless cropping possible. It is described at http://sylvana.net/jpegcrop/. If this is the case it should be easy to implement lossless cropping.
The jpegtran bundled with f-spot does not contain the croppatch. Just as you, I think that cropping should be done losslessy. Having this functionality in f-spot imply patching libjpegtran, creating bindings in libfspot (in C) and writing a new C# binding in JpegUtils. Before doing it, it require to solve the following issue: libjpegtran is borrowed from gthumb; does libjpegtran in f-spot in sync with the gthumb one ? Or it was only a one-time ? If libjpegtran is still in sync with gthumb, maybe this bug should be in gthumb, which also have a lossy 'crop' functionality.
It was a one time sync. I'm not sure what the state of libjpegtran in gthumb is now but there is no problem with a new sync if if offers crop now.
Created attachment 65484 [details] [review] Lossless jpeg cropping This patch allow lossless jpeg cropping in f-spot. It is based mainly on the diff between the jpegtran code already included in f-spot and the official jpegtran code with cropping functions. This patch contains only the code to do the cropping, not the bindings to the UI. One minor drawback you need to know if you want to use it: the x and y offsets provided must be aligned to jpeg blocks. It they are'nt, x and y offsets will be lowered to match a jpeg block. It means that if x or y are not a multiple of 8, they will be changed to the first multiple of 8 backward. It's not a bug, it's the only way to make jpeg lossless
Created attachment 65486 [details] [review] Lossless jpeg cropping: a minimal UI This is the ui code to show how to use the previous patch. This patch sucks. The UI is not refreshed after cropping, nor the icon view. But the cropping is made... F-Spot will crash if you try to crop a rotated image (i.e. an image not oriented in the file as in the thumbnail) Before doing the complete and working UI code for this, some things need to be discussed: * How to rename the cropped version * If the user choose an aspect ratio for the cropping, and the x and y offset does not match a jpeg block (i.e. are not multiples of 8), what should we do ? - break the constraint and raise the selection to match the blocks ? - raise the selection in the top left to match jpeg block, and raise the selection in bottom right to match the constraint ? * How to let choose the user if he wants a lossless or a lossy cropping ?
Please mark this as a dependency of #338997
As per request in comment #5 I added a dependency to 338997
Ok this is looking very promissing. I'd love to get this into the editing code as it gets reworked. I'll try to write up something of a skeleton design for the new editing interfaces very soon.
Larry, why not committing the libjpegdump (attachment #65484 [details]). It's backward compatible with the previous jpegdump code... It will be easier for other developers to start using it... my €0.02...
Hi, I wonder what are news about lossless cropping in F-spot? Is the patch used in F-spot 0.5.0.3 and Gnome 2.26.1?
Is this feature implemented in gthumb?
hi there, bump - any news on this one? ...I want to stop using IrfanView to have lossless cropping :-)
F-Spot has moved to https://github.com/f-spot/f-spot/issues If this Bugzilla ticket is still valid in a recent version of F-Spot, please feel free to post this topic as a ticket in the F-Spot project on GitHub. Closing this report as WONTFIX as part of Bugzilla Housekeeping as we are planning to shut down GNOME Bugzilla in favor of GNOME Gitlab.