Menu

#7 Rotation depending on exif tags

Unstable (example)
unread
nobody
None
5
2019-09-23
2019-08-12
No

Some programs (like gthumb, but probably many others) implement image rotation by just adding an exif tag which is supposed to inform viewers that they have to rotate the pixels before displaying, but the raw pixel data is untouched.

As a result, if I rotate an image in such a software and then import it in imagination, the image will be displayed unrotated in imagination.

This patch series implements detection of the orientation exif tag, and rotation of the image accordingly.

Obvously I had to revert revision 657 "Removed ability to rotate slides (who uses it?)". Well I do use it, and now it is even automatic :) [patch 1]

I also had to revert revision 656 "Finally got rid of those annoying black borders around the image." because it caused a segfault when exporting

(imagination:4766): GdkPixbuf-CRITICAL **: 13:32:00.060: gdk_pixbuf_new_from_file_at_scale: assertion 'width > 0 || width == -1' failed

[patch 4]

I encountered a bug where imagination just ignores EAGAIN when writting to the ffmeg stdin, which could result in exportation silently failing to produce a file [patch 5]

The actual logic of reading exif tags and so on is in patch 7.

Optional patches, which you can remove if you don't like them (or cherry-pick if you like them, but not the series as a whole):
patch 2 gets rid of some gcc warnings
patch 6 tries to warn if writing to sox fails, instead of failing silently (same root cause as patch 5, and should save debugging time if this ever happens)
patch 9 sets the export progress bar to 100% when export completes (I spent some time trying to debug why my export was stuck at 97% only to find out that it was complete, but still at 97%)
patch 11 changes some error messages

The remaining patches are:
patch 3 makes possible to both flip and rotate an image
patch 8 and 10 deal with bugs where files are missing and this crashes imagination

All in all this got bigger than I initially expected. The git development branch I use is this one:
https://github.com/symphorien/imagination/tree/exif
(apparently subversion does not allow me to fork locally and develop my own patches)

To test this patch series, you can rotate an image as follows:

exiftool -Orientation=2 -n file.jpg

valid values are 1 to 8.
Some values are unsupported because we cannot flip an image vertically.

Note that I have problems displaying the icon of the rotate buttons, but this might be because my gtk icon theme is broken. You may want to check before merging.

11 Attachments

Related

Patches: #7

Discussion

  • Giuseppe Torelli

    Hello mate,

    I don't know how to thank your for your patch. I'm glad when other
    developers help me to improve Imagination. It's a great piece of software
    and lately I don't have time to improve it. I will definitely apply the
    patch to auto rotate the images, it was a feature requested long ago and I
    will see the other ones. Currently there is an annoying bug resulting in
    the audio file to be truncated at the third minute. I understood where the
    problem is but not how to fix it? Perhaps you can give a look?

    Thanks again for your patch.

    Youtube: /giutor73

    On Mon, 12 Aug 2019 at 16:23, Mandatory field symphorienprime@users.sourceforge.net wrote:


    [patches:#7] Rotation depending on exif tags

    Status: unread
    Group: Unstable (example)
    Created: Mon Aug 12, 2019 03:23 PM UTC by Mandatory field
    Last Updated: Mon Aug 12, 2019 03:23 PM UTC
    Owner: nobody
    Attachments:

    Some programs (like gthumb, but probably many others) implement image
    rotation by just adding an exif tag which is supposed to inform viewers
    that they have to rotate the pixels before displaying, but the raw pixel
    data is untouched.

    As a result, if I rotate an image in such a software and then import it in
    imagination, the image will be displayed unrotated in imagination.

    This patch series implements detection of the orientation exif tag, and
    rotation of the image accordingly.

    Obvously I had to revert revision 657 "Removed ability to rotate slides
    (who uses it?)". Well I do use it, and now it is even automatic :) [patch 1]

    I also had to revert revision 656 "Finally got rid of those annoying black
    borders around the image." because it caused a segfault when exporting
    (imagination:4766): GdkPixbuf-CRITICAL **: 13:32:00.060: gdk_pixbuf_new_from_file_at_scale: assertion 'width > 0 || width == -1' failed
    [patch 4]

    I encountered a bug where imagination just ignores EAGAIN when writting to
    the ffmeg stdin, which could result in exportation silently failing to
    produce a file [patch 5]

    The actual logic of reading exif tags and so on is in patch 7.

    Optional patches, which you can remove if you don't like them (or
    cherry-pick if you like them, but not the series as a whole):
    patch 2 gets rid of some gcc warnings
    patch 6 tries to warn if writing to sox fails, instead of failing
    silently (same root cause as patch 5, and should save debugging time if
    this ever happens)
    patch 9 sets the export progress bar to 100% when export completes (I
    spent some time trying to debug why my export was stuck at 97% only to find
    out that it was complete, but still at 97%)
    patch 11 changes some error messages

    The remaining patches are:
    patch 3 makes possible to both flip and rotate an image
    patch 8 and 10 deal with bugs where files are missing and this crashes
    imagination

    All in all this got bigger than I initially expected. The git development
    branch I use is this one:
    https://github.com/symphorien/imagination/tree/exif
    (apparently subversion does not allow me to fork locally and develop my
    own patches)

    To test this patch series, you can rotate an image as follows:
    exiftool -Orientation=2 -n file.jpg
    valid values are 1 to 8.
    Some values are unsupported because we cannot flip an image vertically.

    Note that I have problems displaying the icon of the rotate buttons, but
    this might be because my gtk icon theme is broken. You may want to check
    before merging.


    Sent from sourceforge.net because you indicated interest in <
    https://sourceforge.net/p/imagination/patches/7/>

    To unsubscribe from further messages, please visit <
    https://sourceforge.net/auth/subscriptions/>

     

    Related

    Patches: #7

  • Mandatory field

    Mandatory field - 2019-09-22

    I found a bug with these patches. It is patched in my fork of imagination: https://github.com/symphorien/imagination

    This fork includes a port to gtk3, better detection of unsaved changes to warn when quitting, and most notably tests. I found the bug mentioned above while writing tests.

    I would really like you to merge this fork in the official repository, feel free to discuss the modifications needed for it to happen.

     
    • Giuseppe Torelli

      You come like an angel from heaven! I will get in touch with you tomorrow
      through email ok? I was looking to port Imagination to gtk+3! Thanks a lot.

      On Sun, 22 Sep 2019, 23:44 Mandatory field, symphorienprime@users.sourceforge.net wrote:

      I found a bug with these patches. It is patched in my fork of imagination:
      https://github.com/symphorien/imagination

      This fork includes a port to gtk3, better detection of unsaved changes to
      warn when quitting, and most notably tests. I found the bug mentioned above
      while writing tests.

      I would really like you to merge this fork in the official repository,
      feel free to discuss the modifications needed for it to happen.


      [patches:#7] Rotation depending on exif tags

      Status: unread
      Group: Unstable (example)
      Created: Mon Aug 12, 2019 03:23 PM UTC by Mandatory field
      Last Updated: Mon Aug 12, 2019 03:23 PM UTC
      Owner: nobody
      Attachments:

      Some programs (like gthumb, but probably many others) implement image
      rotation by just adding an exif tag which is supposed to inform viewers
      that they have to rotate the pixels before displaying, but the raw pixel
      data is untouched.

      As a result, if I rotate an image in such a software and then import it in
      imagination, the image will be displayed unrotated in imagination.

      This patch series implements detection of the orientation exif tag, and
      rotation of the image accordingly.

      Obvously I had to revert revision 657 "Removed ability to rotate slides
      (who uses it?)". Well I do use it, and now it is even automatic :) [patch 1]

      I also had to revert revision 656 "Finally got rid of those annoying black
      borders around the image." because it caused a segfault when exporting
      (imagination:4766): GdkPixbuf-CRITICAL **: 13:32:00.060: gdk_pixbuf_new_from_file_at_scale: assertion 'width > 0 || width == -1' failed
      [patch 4]

      I encountered a bug where imagination just ignores EAGAIN when writting to
      the ffmeg stdin, which could result in exportation silently failing to
      produce a file [patch 5]

      The actual logic of reading exif tags and so on is in patch 7.

      Optional patches, which you can remove if you don't like them (or
      cherry-pick if you like them, but not the series as a whole):
      patch 2 gets rid of some gcc warnings
      patch 6 tries to warn if writing to sox fails, instead of failing
      silently (same root cause as patch 5, and should save debugging time if
      this ever happens)
      patch 9 sets the export progress bar to 100% when export completes (I
      spent some time trying to debug why my export was stuck at 97% only to find
      out that it was complete, but still at 97%)
      patch 11 changes some error messages

      The remaining patches are:
      patch 3 makes possible to both flip and rotate an image
      patch 8 and 10 deal with bugs where files are missing and this crashes
      imagination

      All in all this got bigger than I initially expected. The git development
      branch I use is this one:
      https://github.com/symphorien/imagination/tree/exif
      (apparently subversion does not allow me to fork locally and develop my
      own patches)

      To test this patch series, you can rotate an image as follows:
      exiftool -Orientation=2 -n file.jpg
      valid values are 1 to 8.
      Some values are unsupported because we cannot flip an image vertically.

      Note that I have problems displaying the icon of the rotate buttons, but
      this might be because my gtk icon theme is broken. You may want to check
      before merging.


      Sent from sourceforge.net because you indicated interest in <
      https://sourceforge.net/p/imagination/patches/7/>

      To unsubscribe from further messages, please visit <
      https://sourceforge.net/auth/subscriptions/>

       

      Related

      Patches: #7

      • Mandatory field

        Mandatory field - 2019-09-22

        Email is fine. Great to hear that you are interested in merging this :)

         
  • Giuseppe Torelli

    I sent you an email but It bounced back. I sent you an internal message here. Get in touch please, thanks.

     

Log in to post a comment.