Commons:Rotation

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Shortcut: COM:ROTATEFIX

image rotation symbol

Exif-based rotation[edit]

On 5 October 2011 MediaWiki 1.18, a new version of the server-software was deployed on Commons. Starting with this version it automatically rotates image previews and thumbnails (technically the same processes apply, only the dimensions differ) based on an image's Exif data.

However, where images have been rotated before upload without the Exif orientation being reset to "Normal" (= no rotation needs to be applied for viewing), this means the image is rotated again by MediaWiki; we then see a mis-oriented/wrongly rotated image. Our servers cache the thumbnails → that means if a photo has a wrong orientation info in its Exif data (and is physically in the correct orientation) the thumbnails will get mis-oriented as soon as they are (re-)generated by MediaWiki 1.18. This happens on a reupload, on a purge of the file page or at apparently pseudo-random intervals (may be days, weeks or many months) without any user action.

Note: There are still issues pending about bringing rotation into MediaWiki's API.

Situations[edit]

  • Images which are (physically) rotated correctly
    • ... but have an Exif tag which is wrong need the Exif orientation tag to be corrected to "normal". RotateLink can handle such files automatically. Rotatebot can also be instructed manually by tagging the image with {{rotate|resetexif}}. It can also be done manually using tools such as en:ExifTool (this requires downloading and re-uploading the fixed image).
    • ... and have an Exif tag indicating this rotation correctly but were uploaded prior to the 1.18 update will need to be purged. Before purging, thumbnails will display the image in the correct orientation but will be compressed/wrong apect ratio. You may also need to refresh your browser cache. If you're having trouble displaying a Commons image in a Wikimedia wiki, you can try setting an unusual thumbnail size.
  • Images which are (physically) rotated wrongly simply need rotating or adding an Orientation tag (choose one out of three):
    • Rotating automatically: use the "rotate image" link (more info at Help:RotateLink) below the image on the file description page. (This applies the {{Rotate}} template which gives instructions to user:Rotatebot.)
    • Rotating manually: When rotating JPEGs by 90, 180, or 270 degrees, perform a (usually) lossless rotation using a tool such as jpegtran. For more help and a notice that the JPEG rotation cannot always be completely lossless, see Commons:Media for cleanup#Sideways pictures or pictures with noticeable camera tilt. Some tools that are useful for manual, lossless rotation: For Linux there are many tools which can do it (e.g. gThumb), for Windows for example XnView. A short, user review (from December 2011) of some programs in German is here.
    • Adding the correct Orientation tag manually (this description needs details added):
      • exiftool -Orientation=(value, like “6” or “'Rotate 90 CW'” for 90° rotation)
      • Geeqie — for example, rotate the image viewed and then apply the orientation change to metadata (there is an option to always apply the change).
      • The advantage of this option is that it is always lossless, no matter what dimensions the image has. However, for images for which truly lossless physical rotation is possible, the following should be considered:
        1. Exif orientation support by MediaWiki is only partly (100% view is not rotated since no browser supports it and MediaWiki doesn't do it for the browser [like it does for svgs]).
        2. Support for Exif orientation is generally not good at programs for PCs. Many many programs do not understand it. Images which are physically right are easier to handle for users - a new file version must be uploaded anyway.

Wikipedia articles[edit]

Image is in correct orientation now (after a new file version has been uploaded [by Rotatebot]) but still wrong in the article (should only happen if you view the article not logged-in)?

See also[edit]