Copy link to clipboard
Copied
Hi
Is there a way where we can extract the dimensions (width x height, in picas), Color information (RGB, CMYK or Grayscale) and Resolution of the image (dpi in pixels per inch). for a jpeg file that has been created in PS CC 2015.5
May be a script or a plugin.
FYI - We want to do a batch process over may be 300 - 400 files for extracting metadata.
Regards
Ray
OK, here is the ExifTool code:
exiftool -r -File:ImageWidth -File:ImageHeight -File:ColorComponents -JFIF:XResolution -JFIF:YResolution -IFD0:XResolution -IFD0:YResolution -IFD0:ResolutionUnit -csv '/Users/loggedinusername/Desktop/test' > '/Users/loggedinusername/Desktop/exiftool-metadata-dump.csv' -ext .jpg
The output looks like this (reformatted for display from .csv):
======== /Users/loggedinusername/Desktop/test/IMG-CMYK.jpg
Image Width : 2448
Image Height : 326
...Copy link to clipboard
Copied
What about total commander plugin? http://sklad.bereza.cz/00-jarda/00_screenshot/2016-08-15_191637.jpg
If you want photoshop then...
1) Change your units into picas
2) var width = app.activeDocument.width
3) height similar like width
4) var activeChannels = app.activeDocument.channels.length; // 4 - CMYK, 3 - RGB, 1 - grayscale // inacuracy is possible
5) var resolution = app.activeDocument.resolution;
6) write it in text file
I think you can do batch process and select your script in this dialog.
Copy link to clipboard
Copied
If you don't have to do it in PS, exiftool is your friend. PS has all of the apis for getting the info you need. Check the docs.
Copy link to clipboard
Copied
rays78423212 wrote:
Hi
Is there a way where we can extract the dimensions (width x height, in picas), Color information (RGB, CMYK or Grayscale) and Resolution of the image (dpi in pixels per inch). for a jpeg file that has been created in PS CC 2015.5
May be a script or a plugin.
All of what you seem to want can be retrieved with a Photoshop script all items seem to be basic document information the is in Adobe DOM Document Object. However each file would most likely need to opened and closed by Photoshop to retrieve all that data. That can take some time. If you also use Adobe Bridge. Bridge can also be scripted. However I have never created a Bridge script. I only bring this up because all basic file information would be available in Bridges databases or image cache so a bridge script would most likely be able to retrieve that data without having to open the file for it has already collected the data you want. You may need to calculate PICAS using the document width and height in pixels. I would think a Bridge script would run quicker than a Photoshop script. However I have no idea of what can be done in a Bridge script. Perhaps X can shed some light on that.
Copy link to clipboard
Copied
I second xbytor’s ExifTool recommendation, it is only one line of code (I’ll share the code in a separate post).
JJMack is correct that Bridge is most likely the best place to do this with Adobe apps, the following script by Paul Riggott covers most but not all of your metadata options. It might be “easy enough” to graft on the missing bits:
https://www.ps-scripts.com/viewtopic.php?f=72&t=24358&sid=6529114a378b6e37ff888bf74ba105cf
While another Bridge option can be found here, again not all required metadata is covered:
Copy link to clipboard
Copied
OK, here is the ExifTool code:
exiftool -r -File:ImageWidth -File:ImageHeight -File:ColorComponents -JFIF:XResolution -JFIF:YResolution -IFD0:XResolution -IFD0:YResolution -IFD0:ResolutionUnit -csv '/Users/loggedinusername/Desktop/test' > '/Users/loggedinusername/Desktop/exiftool-metadata-dump.csv' -ext .jpg
The output looks like this (reformatted for display from .csv):
======== /Users/loggedinusername/Desktop/test/IMG-CMYK.jpg
Image Width : 2448
Image Height : 3264
Color Components : 4
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
======== /Users/loggedinusername/Desktop/test/IMG-Gray.jpg
Image Width : 2448
Image Height : 3264
Color Components : 1
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
======== /Users/loggedinusername/Desktop/test/IMG-RGB-SFWL.jpg
Image Width : 2448
Image Height : 3264
Color Components : 3
The first two images were saved via File>Save As, so they have more info in them to extract. The third file was saved via Save for Web (Legacy) excluding all metadata, so there is less info available.
You would perhaps need to do a find/replace in a spreadsheet program to replace the Color Component column, changing 1 to Grayscale, 3 to RGB and 4 to CMYK.
I can explain the CLI code in more detail if required (I have applied faux syntax highlighting to help break up the various components). This code is formatted for the Mac OS, MS Windows would use straight double quote marks " and the expected \ file path formatting.
Hope this helps.
Copy link to clipboard
Copied
Thank you all of you for the information.
Hi Stephen_A_Marsh,
I will give this a shot, by the way we are working on a single file here, right ?
I need is to do it over a batch of 300 - 400 jpeg files.
Regards
Ray
Copy link to clipboard
Copied
Hi Ray, try it! :]
Hint 1: The code did not list a source file, only a target folder...
Hint 2: The output sample listed three files, when no file was explicitly input!
I can describe the code in more detail if desired, however I am interested in your results from my previous sample.
P.S. Will you be running ExifTool on a Mac or Win OS?
Copy link to clipboard
Copied
Windows 10 and Mac OS X 10.11.6
I have tested this on Windows 10 and it seems to be working as expected.
So i dragged a jpeg to the .exe file and got the results.(much more than i was expecting).
I also tested the script and got the results in a spread sheet.(Screen shot attached).
The only thing i need to do now is to convert it to picas.
Ray
Copy link to clipboard
Copied
Ray I tested Paul's extract metadata bridge script. It just needed to be copy to bridge startup scripts. It does not support all the fields you want to extract. I think they could be added looking at the code. One would need to know which metadata area and field name. I select 200+ thumbnails in the bridge then use the bridge metadata menu that was added by the script. Selected the extract metadata script. Checked all fields in its dialog and than clicked create the CVS button. Almost immediately I received a script message stating that the CVS file was created on my desktop.
Copy link to clipboard
Copied
s/CVS/CSV/ ?
Copy link to clipboard
Copied
Yes CSV I can not type....
Copy link to clipboard
Copied
Hi Ray, you wrote:
So i dragged a jpeg to the .exe file and got the results.(much more than i was expecting).
I am curious about the “much more than I was expecting” part!
As the ExifTool output is based on pixels, you will need to open the .CSV into a spreadsheet or other data manipulation software to transform the X and Y resolution columns. You will need to divide the existing pixel values by 12, which should be easy enough to do with a formula or other automated approach that can be applied to the entire column of data.
Copy link to clipboard
Copied
Ray
Copy link to clipboard
Copied
Hi Ray, thanks for explaining – that is expected and makes sense.
You have effectively created the following command, which will list “all” metadata, no matter the type:
exiftool C:/Path/to/file/or/folder/here
However if a folder or filename has a word space in it, you will need to wrap it in straight double quote marks (straight single quotes for Mac/Unix):
exiftool "C:/Path/to/file/or/folder here"
The reason I put “all” in quotes is that this may not be all metadata, as duplicates may be hidden with this simple command. The tag output is also listed in “plain english descriptions” – these are not the actual commands that one would use to read/write or perform other operations with, you would need to use this command to see any duplicates and actual tag names used internally by ExifTool for performing operations:
exiftool -a -G1 -s "C:/Path/to/file/or/folder here"
If you needed to recursively scan into multiple sub-folders from the top level folder, then you would need to a command switch of -r or -recurse such as:
exiftool -r -a -G1 -s "C:/Path/to/file/or/folder here"
Finally, you don’t wish to dump every possible bit of metadata to your CSV file, you only asked for specific data, which is why I added the following tags to the original ExifTool command:
exiftool -r -File:ImageWidth -File:ImageHeight -File:ColorComponents -JFIF:XResolution -JFIF:YResolution -IFD0:XResolution -IFD0:YResolution -IFD0:ResolutionUnit