5 Replies Latest reply on Jan 16, 2015 11:12 PM by areohbee

    thumbnail orientation

    Judas Gutenberg

      I notice that when I generate thumbnails from a catalog, they're frequently oriented wrong (rotated 90, -90, or 180 degrees). Is there something I can look for in the metadata for an image to give me guidance for rotating the image such that it is oriented correctly?  I'm using Rob Cole's function to generate the thumbnails:

       

      Here is a function to read preview images from active catalog

        • 1. Re: thumbnail orientation
          Judas Gutenberg Level 1

          I should mention that I DO have some guidance when the image is 90 or -90 degrees off:  the height and width of the image do not match the scaled-down heights and widths of the original images (data that comes in the metadata).

          • 2. Re: thumbnail orientation
            johnrellis Most Valuable Participant

            Rob will likely have a better answer, but one thing to look at is photo:getDevelopSettings ().orientation.   See this thread: Re: Develop setting "orientation"?.

            • 3. Re: thumbnail orientation
              areohbee Level 5

              The "previews:getImage" function in Elare Plugin Framework has a boolean parameter named 'orient'.

               

              Try reversing it (set it to true if it was false, or false if it was true).

               

              Note: the freshest code for the framework comes from any newly released plugin of mine, the released framework package is getting kinda stale..

               

              Background: previews are already oriented (without any metadata), so if you apply orientation metadata afterward, then they are "over-oriented" (oriented wrong).

               

              Rob

              • 4. Re: thumbnail orientation
                Judas Gutenberg Level 1

                i wasn't using previews:getImage, so i don't know how i would have made that work. in any case, photo:getDevelopSettings ().orientation seemed to do the trick. it produces two-letter strings depending on the rotation that will need to be applied to the unrotated thumbnails:

                 

                AB-- no need to rotate

                BC-- need to rotate 90 degrees

                CD -- need to rotate 180 degrees

                DA -- need to rotate 270 (or -90) degrees

                 

                my thumbnails are ultimately being uploaded to a website, and i was able to use this info to apply CSS transforms to thethumbnails so they would be oriented properly.  thanks guys for your help!

                • 5. Re: thumbnail orientation
                  areohbee Level 5

                  Judas Gutenberg wrote:

                   

                  i don't know how i would have made that work.

                  Here's how:

                  * download elare plugin framework (or any of my plugins that uses it).

                  * call previews:getImage function, and set orient param as appropriate.

                  Alternatively:

                  * recode Previews:getImage function to divorce from elare plugin framework.

                   

                  PS - there are 8 codes total - the other 4 include permutations with horizontal and vertical flip.

                  An example code excerpt:

                  if orient == 'AB' then -- unflipped/unrotated, or its flipped & rotated equivalent.
                              -- degrees = 0 - for purposes here, no need to rotate if 0 degrees.
                              return
                          elseif orient == 'BC' then
                              p = "Rotate 90 CW" -- CW required.
                          elseif orient == 'CD' then
                              p = "Rotate 180" -- must not include a "CW" suffix.
                          elseif orient == 'DA' then
                              p = "Rotate 270 CW" -- must be CW.
                          elseif orient == 'BA' then -- flipped horizontal, no rotation.
                              p = "Mirror Horizontal"
                          elseif orient == 'AD' then -- ", 90
                              p = "Mirror Horizontal and Rotate 90 CW"
                          elseif orient == 'DC' then -- ", 180 (which is equivalent to flipped vertically).
                              p = "Mirror Vertical"
                          elseif orient == 'CB' then -- ", 270
                              p = "Mirror Horizontal and Rotate 270 CW"
                          else
                              app:callingError( "^1 has '^2' db-orientation, which is not yet supported - please report error: ", str:to( self.file ), orient )
                          end
                  

                   

                  R