Ticket #8489: mythgallery-orientation.diff

File mythgallery-orientation.diff, 2.3 KB (added by eallaud@…, 14 years ago)

diff file against trunk

  • mythgallery/mythgallery/galleryutil.cpp

     
    141141            {
    142142                    ExifEntry *entry = exif_content_get_entry (data->ifd[i],
    143143                                                        EXIF_TAG_ORIENTATION);
     144                    ExifByteOrder o = exif_data_get_byte_order (data);
     145
    144146                    if (entry)
    145147                    {
    146 #if NEW_LIB_EXIF
    147                         exif_entry_get_value(entry, exifvalue, 1023);
    148                         QString value = exifvalue;
    149 #else
    150                         QString value = exif_entry_get_value(entry);
    151 #endif
    152                         if (value == "left - bottom")
     148                        ExifShort v_short = exif_get_short (entry->data, o);
     149                        VERBOSE(VB_GENERAL, QString("Exif entry=%1").arg(v_short));
     150                        /* From http://sylvana.net/jpegcrop/exif_orientation.html
     151Read this table as follows
     152Entry #6 in the table says that the 0th row in the stored image is the right side of the captured scene, and the 0th column in the stored image is the top side of the captured scene.
     153Example left bottom means (L stands for Left side of real picture and B for bottom):
     154Stored picture
     155LLLLLLLLLL
     156B        |
     157B        |
     158B        |
     159B--------+
     160That is the real picture is
     161L-----+
     162L     |
     163L     |
     164L     |
     165L     |
     166L     |
     167LBBBBBB
     168
     169So this means a rotate angle of -90 degrees from the natural orientation
     170and so on...
     171                           Value  0th Row       0th Column
     172                           1      top           left side
     173                           2      top           right side
     174                           3      bottom        right side
     175                           4      bottom        left side
     176                           5      left side     top
     177                           6      right side    top
     178                           7      right side    bottom
     179                           8      left side     bottom
     180                        */
     181                        /* We are only interested in "normal" mis-orientation
     182                           that is you took the picture handing your camera
     183                           rotated to take portrait */
     184                        if (v_short == 8)
    153185                        {
    154186                          rotateAngle = -90;
    155187                        }
    156                         else if (value == "right - top")
     188                        else if (v_short == 6)
    157189                        {
    158190                          rotateAngle = 90;
    159191                        }