add lossless (jpg) rotation

Bug #306635 reported by Bertrand G
2
Affects Status Importance Assigned to Milestone
IntiPunku
Fix Committed
Critical
Mark Baas

Bug Description

The current rotation of Intipunku creates a low-quality and reduced copy of the jpg file, and eventually stores the original in a subdirectory (originals).

I would like the rotations to keep the following from original:
- the image size
- the jpg (or other png...) compression level
- the metadata (currently completely blanked out)
- the creation and modification timestamps of original file

The above options (e.g. jpg compression level) could eventually be configured in preferences... but should to me be the default behavior.

This has been tested by rotating a 2800x2100 jpg image (original file size of 1.5Mb), hitting "rotating right" makes a copy into an "originals" subdirectory to where the file is located (thanks for keeping this original at least!) and creates a reduced copy of 2100x2800 (ok) of 305Ko (much less!).

Thanks.

PS: a possible alternative could be to take into account the "image - orientation" metadata of the images to orient them accordingly... and just update this tag when the "rotate" buttons are hit... but I don't know if you like this approach, nor if it works for other formats than jpg.

Revision history for this message
Mark Baas (mark-baas123) wrote :

Hi Bertrand, you are right there is some loss in jpeg saving, not just rotating. I am going to look at it. However you also state that the metadata gets blanked out. This is a serious bug, since i have been spending a long time making sure this works. Please report a separate bug for this issue and provide the output of intipunku. I will also need the output of: "exiv2 -Pkycv <path to image>. You can also simply post the image.

Changed in intipunku:
assignee: nobody → mark-baas123
importance: Undecided → Critical
status: New → Confirmed
Revision history for this message
Bertrand G (berteh) wrote :

Hello Mark,

I cannot reproduce the metadata loss part of this bug report, so please consider there is none.

Actually the metadata is indeed kept (some tags are added or updated but none are lost) after jpg rotation. I guess I must have had caching issue at the time of reporting the former bug... I'll check twice next time.

The quality loss issue still remains open, as you mentioned.

Thanks for your efforts in improving this great software, and receive my Seasons Greetings! Happy Christmas and a great New Year.
B.

Revision history for this message
Mark Baas (mark-baas123) wrote :

Okay dont worry about the metadata loss. Since i left behind the pyexiv bindings it is sometimes buggy.
The rotation issues, PIL the imaging library does not support lossless rotation. However it now saves with a higher quality than before. Something like 93 instead of 90. when doing 95 the file becomes bigger. PIL is a pain in the ass, but changing to another processing tool will take too much effort.

Happy holiday to you too!!

Revision history for this message
Mark Baas (mark-baas123) wrote :

I consider to implement an extra component called lossless jpeg rotation. It means if you have jpegtran installed it will use jpegtran to rotate rather than PIL.

Another solution could be simply to write the Exif.Orientation. Most programs support this exif tag for rotation.

What do you think?

Revision history for this message
Mark Baas (mark-baas123) wrote :

implemented with the use of jpegtran

Changed in intipunku:
status: Confirmed → Fix Committed
Revision history for this message
Bertrand G (berteh) wrote :

great, thanks.
Did you use the other functions of jpegtran as well at the same time (eg lossless croping)?
B.

Revision history for this message
Mark Baas (mark-baas123) wrote :

We can look at this in the future, however, jpegtran makes everything slower, but as long as it is optional and there is demand for this feature then why not.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.