Cropped or straighten portrait photos are stretched when exported, sent or published
Submitted by an unknown user
Link to original bug (#719230)
Description
---- Reported by shotwell-maint@gnome.bugs 2013-06-04 14:55:00 -0700 ----
Original Redmine bug id: 7035
Original URL: http://redmine.yorba.org/issues/7035
Searchable id: yorba-bug-7035
Original author: Fr édéric Le Cam
Original description:
Shotwell 0.14.1 on Ubuntu 12.04
This bug occurs with photos in portrait mode, rotated after Exif datas (when physically rotated, everything is OK but Shotwell DOESN'T physically rotate photos like does Gthumb for example).
-
Crop or straighten such a photograph
-
Choose to send it by mail, export in a folder or publish on the web (Picasaweb in my case)
-
Choose to resize the picture (export with original size works OK)
-
The exported picture is stretched (with switched width and height)
It may have something in common with 6945...
Thanks for your awesome work.
Related issues:
- duplicated by shotwell - 6945: Cropped photos published to Facebook are stretched (Duplicate)
---- Additional Comments From shotwell-maint@gnome.bugs 2013-09-19 15:31:00 -0700 ----
History
Comment 1
Updated by Joe Bylund 6 months ago
I can reproduce this. I don't believe it's the same but I suspect it's very similar. I'm looking at Photo.vala:~3587, where the comment reads: "Since JPEGs can store their own orientation, we save the pixels directly and let the orientation field do the rotation...", but because the scale needs to be applied to the properly rotated image this is the source of our distortion. In order to be able to use the exif to set the proper orientation we'd have to "counter-rotate" the scaling (interestingly for 180 degrees they should cancel each other out).
Comment 2
Updated by Jim Nelson 6 months ago
- Category set to library-mode
- Target version set to 0.15.0
I've been trying to repro this since #6945 was reported and have not been able to. I finally did today. Here's what I had to do:
- Use a photo with a non-identity Orientation (i.e. top-left). My phone doesn't use Orientation, even for portrait images; I had to use some old photos from my point-and-click that uses Orientation for portraits.
- Crop.
- Export to a non-original size.
Stretched image as described.
I suspect this is a duplicate of #6945, but won't mark as such until the problem is solved.
Comment 3
Updated by Dražen Lučanin 4 months ago
Any news on this? I found a workaround by opening the photo with an external editor (GIMP) and cropping it a bit more there. Once exported, the photo is then normal, not stretched.
Comment 4
Updated by Mikko Huhtala 4 months ago
I can reproduce this on shotwell-0.14.1-1.fc19.x86_64 on Fedora 19. I only get the stretched images when I export a resolution that requires scaling. Exporting with the setting "original size" works correctly (of course, the size isn't quite original after straightening/cropping, but the right thing happens).
Comment 5
Updated by Joe Bylund 4 months ago
If people are ok with lossy jpg crops I think I can do this pretty quick. Jim?
-Joe
Comment 6
Updated by Jim Nelson 4 months ago
If someone wants to step up with a patch, we'd gladly accept one!
And lossy crops are fine -- Shotwell doesn't support JPEG lossless cropping today anyway.
Comment 7
Updated by Joe Bylund 3 months ago
- File 7035.patch added
Jim,
What I was trying to say is that there are two ways to effectively achieve a rotation. The first is to actually rotate the pixels, which is a lossy operation, the second is to change the orientation in the exif info. Changing the exif is a lossless operation even for lossy formats, i.e. you could undo it an get the original back, which is not necessarily true of changing pixels. For jpgs the code was attempting to do the latter. I propose for the moment we just do it the former way. Patch attempts to do that, seems to work for me, but I'd appreciate some more testing.
-Joe
Comment 8
Updated by Jim Nelson 3 months ago
Ok, I thought you were talking about lossless JPEG cropping.
We do not want to lose lossless rotation in Shotwell, it's a big deal that we export full-sized rotated photos (with no other transformations) without re-encoding the image. This ticket's bug is a regression, we know this can work without losing lossless rotation, so I'd ask if you could look again and find the root of the problem.
Comment 9
Updated by Joe Bylund 3 months ago
-
File deleted (
<strike>
_7035.patch_</strike>
)
Comment 10
Updated by Joe Bylund 3 months ago
- File 7035.patch added
I think the issue is that get_crop gets the coordinates of the crop in the transformed coordinate system. This fixed the issue for me and a little bit of futzing around with exporting didn't show any new weirdness.
Comment 11
Updated by Jim Nelson 3 months ago
- Status changed from Open to Review
Thanks! We'll take a look at this soon.
Comment 12
Updated by Anonymous 2 months ago
- Status changed from Review to Fixed
Applied in changeset c3a3be28.
--- Bug imported by chaz@yorba.org 2013-11-25 22:11 UTC ---
This bug was previously known as bug 7035 at http://redmine.yorba.org/show_bug.cgi?id=7035 Imported an attachment (id=262766)
Unknown milestone "unknown in product shotwell. Setting to default milestone for this product, "---". Setting qa contact to the default for this product. This bug either had no qa contact or an invalid one. CC member joseph.bylund+shotwell@gmail.com does not have an account here The original submitter of attachment 262766 was joseph.bylund+shotwell@gmail.com, but he doesn't have an account here. Reassigning to the person who moved it here: chaz@yorba.org.
Version: 0.15.0
Resolution: RESOLVED FIXED