Commons:Rotation
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:
- 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]).
- 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)?
- Wikis without flagged revisions : → The Wikipedia article pages maybe need a purge (or a [null] edit or simply some days waiting). And be sure to refresh your browser's cache if it still persists. To perform a null edit, press the edit button and save without making any changes. A null edit will not appear in the editing history or effect the page in any way.
- Wikis with flagged revisions and the last sighted page version as standard page view for anons (like the German Wikipedia): → Before the purge as mentioned above a re-sighting (re-review, re-flag) of the article may be / is needed. Alternatively you can just wait until the next edit on the article happens. See for more info the discussion at the archived section „Werden Bilder, deren Exif-Daten durch Rotate-Bot korrigiert wurden, in den gesichteten Versionen weiterhin verdreht angezeigt?“ at de:Wikipedia:Fragen zur Wikipedia.
- German Wikipedia: There is a bot doing the re-sighting automatically for Rotatebot-rotated images, so you do not have to do that manually.
See also[edit]
- Commons:Bots/Work requests/Archive 6#Maintenance Category for files with Exif rotation other than 0 degrees
- Commons:Village pump/Archive/2011/10#Autorotation Using Exif tag with MW 1.18
- ja:Wikipedia:井戸端/subj/縦画像について
- en:Template:HD/rotate
- Category:Technical examples
- toolforge:ftools/general/rotate-image.html