1

I am using scripting in Photoshop to process jpg files that are uploaded through a website. I occasionally get images that are rotated differently when you open them in Photoshop vs. Windows Previewer (or any other basic graphics program). And today I just came across one that was rotated 90 degrees and mirrored horizontally when you open it with Photoshop. This throws off the scripting b/c the image is not the expected size and orientation.

Is there a setting in Photoshop preferences to stop it from automatically rotating and mirroring these images? Or a way to strip this extra data that Photoshop is reading?

I am using Photoshop CS4 and in preferences, under Camera Raw Settings, I have it set to "disable JPEG support".

1
  • 2
    Photoshop doesn't auto-rotate images so whatever is going on is a tech support issue.
    – Ryan
    May 12, 2014 at 21:54

3 Answers 3

2

Photoshop Supports the EXIF Orientation Value and the Windows Photo Viewer does not!

You can ignore the EXIF Profile Tag in Photoshop Preferences - File Handling

More info:

Beware of Rotating Photos in Windows Picture / Photo Viewer! Another surprising detail is that if you decide to perform lossless image rotation (by using the Rotate Clockwise or Rotate CounterClockwise buttons), the EXIF Orientation flag is removed! As the flag is removed/reset, if you do a rotation followed by its reverse rotation on a portrait photo (eg. rotate clockwise, then rotate counter-clockwise), the resulting orientation observed by other viewers such as Photoshop will be wrong!

http://www.impulseadventure.com/photo/exif-orientation.html

3
  • I've tried using the "ignore EXIF Profile" setting in the preferences but it didn't make a difference. Plus, one particular image I found is rotated and mirrored when I open it in Photoshop. weird...
    – jessieloo
    May 13, 2014 at 12:23
  • I assume you also tried the ignore rotation metadata? You can batch delete metadata in adobe bridge but i dont have much experience with that. About the mirrored image: i can only assume but apparently webcams do flip images.
    – tim human
    May 13, 2014 at 12:43
  • hmmm... I don't have the option for "ignore rotation metadata". Maybe that was introduced after cs4?
    – jessieloo
    May 13, 2014 at 13:17
1

Unfortunately the easiest path is not available to you in CS4... that of a conditional that tests for aspect ratio and rotates in response to the wrong, before continuing. You can see that here: http://helpx.adobe.com/photoshop/using/conditional-actions-creative-cloud.html

The only other alternative I can think of, that's easy and quick, is to use a naive image processor to open all images without seeing the rotation data, that then exports them without it. Setting this app up to batch process all files will give you the result you need with minimal effort.

If Windows Previewer is giving you the right result, then I'd suggest using that to do the batch processing. There's a multitude of scripting tools and macro makers for Windows as a whole that can help you configure an automated process. Including good old fashioned batch files that's now morphed into cmd.exe files.

1
  • Although I can't do the conditional action in CS4, I am able to do the same kind of thing with scripting. Only issue is that the last image i found was not just rotated; it was also mirrored. I will probably try creating a batch file. thanks
    – jessieloo
    May 13, 2014 at 12:36
0

I was able to fix the auto-rotation due to the exif data with this script. (thanks to this adobe forum post) I'm sure there are more cases that need to be fixed, but this solves the ones I have run into...

EXIF = function EXIF(obj) {  
  if (obj.typename == "Document") {  
    this.exif = obj.info.exif;  
  } else {  
    this.exif = obj;  
  }  
  this.caseSensitive = false; // if needed  
};  
EXIF.prototype.get = function(tag) {  
  var exif = this.exif;  

  for (var i = 0; i < exif.length; i++) {  
    var name = exif[i][0];  
    if (name == tag) {  
      return exif[i][1];  
    }  
  }  

  if (!this.caseSensitive) {  
    tag = tag.toLowerCase().replace(/\s/g, '');  

    for (var i = 0; i < exif.length; i++) {  
      var name = exif[i][0];  
      name = name.toLowerCase().replace(/\s/g, '');  
      if (name == tag) {  
        return exif[i][1];  
      }  
    }  
  }  

  return '';  
}; 

var exif  = new EXIF(docRef);
var orientation = exif.get('Orientation');
if(orientation.substring(0,7) == 'Rotate '){
    // compensate for auto-orientation
    var rotate = parseFloat(orientation.substring(7,orientation.length));
    if(! isNaN(rotate))
        docRef.rotateCanvas(rotate*-1);
}

if(orientation == "Flip Horizontal")
    docRef.flipCanvas(Direction.HORIZONTAL);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.