1

I am working on an Image Manipulation utility. The requirement is to rotate the image by updating its metadata (exif information). I have tried to do the same but not succeeded. Kindly suggest some pointers ?

Anil C
  • 1,045
  • 3
  • 16
  • 38
  • 1
    i'm pretty sure you cant rotate an image just by changing its exif data. – Muad'Dib Aug 23 '11 at 18:12
  • Agreed, EXIF is just metadata. It does not affect the way an image is displayed to a user unless the opening program is specifically looking for it. – Kevin Kalitowski Aug 23 '11 at 18:15
  • @Mudd'Dib - Any idea how can this be done? – Anil C Aug 23 '11 at 18:15
  • @Kevin - Actually the images are shot by Digital Camera. Now while uploading to the server, I want to rotate them to actual orientation so that user can see the images in a proper orientation. Any idea how this can be achieved? – Anil C Aug 23 '11 at 18:16
  • I was intruiged by this an didn't know EXIF data contained orientation info. This describes it, very interesting: http://www.impulseadventure.com/photo/exif-orientation.html – Alex KeySmith Aug 23 '11 at 18:31

2 Answers2

0

This is going to have to be done using a manual process, not EXIF data.

By manual I mean moving pixels around. You can find examples online of how to do this using helper classes, perhaps the .NET Framework depending on what platform you are developing on.

Example: http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-rotate

Kevin Kalitowski
  • 6,829
  • 4
  • 36
  • 52
0

From what I understand, you do not wish to actually transform the image and roatate it's pixel data, but instead "display" it rotated.

I've never thought about this before and not familier with EXIF etc. But of the top of my head.

Displaying the orientation in the browser

The really tricky bit is going to be displaying it in the browser.

Here are a couple of feature requests discussing adhearing to orientation in browsers:

firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=298619

chrome: http://code.google.com/p/chromium/issues/detail?id=56845

I haven't read these requests fully, so I'm not sure exactly of their status, but could be interseting reading for you.

Getting EXIF data

If the browser doesn't support built in EXIF orientation (which it probably doesn't), first you need to get ahold of the EXIF data, you could do this client side by looking at the raw binary data being pulled from the server...

But I'm guessing doing it server-side would be much easier.

Here is a c# library for getting EXIF data http://www.codeproject.com/KB/graphics/exifextractor.aspx Admitadly I didn't find it, it was discussed here: How to get the EXIF data from a file using C#

You could either

  • Rotate it manually via server side code (actually manipulating the pixels - probably loads of libraries to do this, probably built into .net)
  • Using Flash rotate it (infact I think flash maybe able to read EXIF directly)
  • Using the HTML canvas to rotate (maybe using jquery rotate or something similar)
Community
  • 1
  • 1
Alex KeySmith
  • 16,657
  • 11
  • 74
  • 152