Skip to main content
Participating Frequently
June 17, 2018
質問

Use the ps script to get the exif of the image without opening it in photoshop

  • June 17, 2018
  • 返信数 2.
  • 4289 ビュー

Use the ps script to get the exif of the image without opening it in photoshop?

このトピックへの返信は締め切られました。

返信数 2

Kukurykus
Legend
June 17, 2018

What file format - .jpg, .psd, other? What language do you use in your Photoshop - English, Japanese, other?

su仙人作成者
Participating Frequently
June 17, 2018

is  jpg  , I use Chinese in my Photoshop

Kukurykus
Legend
June 17, 2018

This scripts works for all kind of file formats also takes into consideration if the file was rotated in system:

(function(v){

     function sTT(v) {return stringIDToTypeID(v)}; function f(v1, v2) {

          if (arguments.length < 2) return r.getInteger(sTT(v1), 'px')

          return executeAction(sTT(v1 + 'ViewlessDocument'), v2)

     }

     (dsc1 = new ActionDescriptor()).putBoolean(sTT('preferXMPFromACR'), true)

     dsc1.putPath(sTT('file'), v), (r = f('open', dsc1)).getData(d = sTT('document'));

     (dsc2 = new ActionDescriptor()).putData(d, r.getData(d)), f('close', dsc2)

     return [f('width'), f('height')]

})(File('~/desktop/someFile.jpg'))

Legend
June 17, 2018

You might have a good look at Exiftool, which can read out pretty much any metadata of your document.

Hope this can help.

su仙人作成者
Participating Frequently
June 17, 2018

Thank you,i know the software ,but i just went to use PS JavaScript 。。。。

SuperMerlin
Inspiring
June 17, 2018

#target photoshop;

ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");

var s = File.openDialog("Please select JPG file.","JPG File:*.jpg");

var file = new XMPFile(File(s).fsName, XMPConst.FILE_UNKNOWN, XMPConst.OPEN_FOR_READ);   

var xmp = file.getXMP();

if( xmp.doesPropertyExist(XMPConst.NS_EXIF, "PixelXDimension" ) ) {

    var x= xmp.getProperty(XMPConst.NS_EXIF, "PixelXDimension" );

    var y= xmp.getProperty(XMPConst.NS_EXIF, "PixelYDimension" );

    alert("X = " + x + " Y = " + y );

}else{

    alert("This files does not have EXIF dimensions");

    }