Copy link to clipboard
Copied
Hi guys,
I'm looking for a way to see the total number of pixels in a photo. So height times width of the pixels. Is there perhaps already a script or an action for this and if so where?
Best regards
Norbert
---------
Hallo Leute,
ich suche nach einer Möglichkeit die gesamte Anzahl der Pixel eines Fotos zu sehen. Also Höhe mal Breite der Pixel. Gibt es dafür evtl. schon ein Script oder eine Aktion und wenn ja wo?
Beste Grüße
Norbert
Hello Stephen,
Many thanks for your help.
In the histogram panel I can only see the MB but not the MP.It's all a bit too complicated for me - sorry.
So I'll get some help and recommend your links.
Yes, triggering an action like this would be ideal.
CheersNorbert
By @norberta70820063
Mega pixels is total pixels divided by 1 million.
https://github.com/MarshySwamp/Report-Megapixel-Value/blob/main/Report%20Megapixel%20Value.jsx
https://prepression.blogspot.com/2018/03/photoshop-mega-pixel-value-script-mp.html?m=1
...With the help of Rick Maschke, the problem is solved.
Copy link to clipboard
Copied
If the image is flattened, then Image > Canvas Size or even Image > Image Size or the Properties or Info panel can show the current pixel width and height. The histogram panel will list the width x height in pixels.
If there are layers, their content may be smaller or larger than the canvas and can be found via Properties or Transform or scripting bounds.
Yes, this can easily be scripted, but what do you need to do with the total pixel count?
Copy link to clipboard
Copied
Hello Stephen,
Thank you for your contribution,
but please don't discuss why I need this information.
These are specifications from a very specific photo agency for very large panoramas.
Of course you can easily calculate this for individual panoramas, but with over 1600 panoramas the fun slowly stops.
So how and where do I get the information about the total number of pixels?
Greetings
Norbert
Copy link to clipboard
Copied
Hello Stephen,
Thank you for your contribution,
but please don't discuss why I need this information.
These are specifications from a very specific photo agency for very large panoramas.
Of course you can easily calculate this for individual panoramas, but with over 1600 panoramas the fun slowly stops.
So how and where do I get the information about the total number of pixels?
Greetings
Norbert
By @norberta70820063
Start here:
https://prepression.blogspot.com/2016/08/extracting-metadata-to-csv.html
Copy link to clipboard
Copied
Simple script snippet:
try{
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var h = app.activeDocument.height;
var w = app.activeDocument.width;
var t = h * w;
Window.alert(h.toString() + ' pixel height\r' + w.toString() + ' pixel width\r' + t.toString() + ' total pixels');
preferences.rulerUnits = originalRulerUnits;
}
catch(e){
Window.alert(e + ' Line: ' + e.line);
}
Copy link to clipboard
Copied
Hello Lumigraphics,
Thanks for your reply.
I assume that this information is a Photoshop script - right?
Unfortunately, I have no experience in creating such scripts myself.
How does that work?
Yes, I have Photoshop running on a Windows/PC.
Can you create such a script for me so that I can simply insert it?
Best regards
Norbert
Copy link to clipboard
Copied
You posted in the Photoshop forum so yes, Photoshop script. This data is also available in Lightroon and Bridge.
This is NOT a "do free work for me" forum. I recommend that you learn how to install scripts if you want to use them, there are lots of resources online to help. I've given you the meat of a script that you can take from there.
Copy link to clipboard
Copied
Thanks for the hint. Ok, I'll try to learn that.
Also, I wasn't asking for a free service, but for a possible existing solution.
Would your script suggestion also work in a German language version?
Copy link to clipboard
Copied
Thanks for your support!
I have found a tutorial in German for the creation of a script:
Copy link to clipboard
Copied
Great! We love it when people can learn from posting here. You can change the English text to German of course.
Copy link to clipboard
Copied
I tried, but I failed.
Creating a script like this is probably a bit too complicated for me - sorry.
Is there really no ready-made solution?
Copy link to clipboard
Copied
I just wrote the script for you. Its right there. Google how to install a script in Photoshop.
And no, when someone wants a specific feature in Photoshop, it may not be there and you may have to write or use someone else's script. Most professional software is like that.
Copy link to clipboard
Copied
I'll try again, but I'm only a musician and photographer 😉
Copy link to clipboard
Copied
What am I missing? Why is a script necessary to multiply w x h?
Copy link to clipboard
Copied
What am I missing? Why is a script necessary to multiply w x h?
By @D Fosse
The bit you missed is needing to do this for 1600+ files.
I'll post a solution later, there should be existing solutions or relatively easy ways to batch generate CSV data.
Copy link to clipboard
Copied
Oh, OK. Knew there was something... 😉
Copy link to clipboard
Copied
My Filename to List Bridge script handles exporting dimensions to tab-delimited text, and Excel would be able to handle the rest. Or modifying the bones of the script snippet I posted above.
Copy link to clipboard
Copied
Sounds good Stephen.
If this could be displayed interactively in Photoshop as you work, that would be ideal.
A script action would also be great.
Lumigraphics has already suggested a script above,
but I simply can't integrate it as an action.
Unfortunately, I don't have the expertise.
Copy link to clipboard
Copied
Sounds good Stephen.
If this could be displayed interactively in Photoshop as you work, that would be ideal.
A script action would also be great.
Lumigraphics has already suggested a script above,
but I simply can't integrate it as an action.
By @norberta70820063
If you need a report, then look at the scripts and ExifTool methods previously linked at my blogpost.
As previously mentioned, total pixels are reported in the Histogram panel.
Do you really want a window popping up each time you open an image? If so, then a script can be set to automatically run when you open a document in Photoshop via the Script Events Manager. Or you can set a custom keyboard shortcut to an installed script or record the execution of a script into an action.
https://prepression.blogspot.com/2021/10/photoshop-script-events-manager.html?m=1
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html?m=1
https://prepression.blogspot.com/2018/03/photoshop-mega-pixel-value-script-mp.html?m=1
https://prepression.blogspot.com/2019/04/photoshop-document-info-aspect-ratio.html?m=1
Copy link to clipboard
Copied
Hello Stephen,
Many thanks for your help.
In the histogram panel I can only see the MB but not the MP.
It's all a bit too complicated for me - sorry.
So I'll get some help and recommend your links.
Yes, triggering an action like this would be ideal.
Cheers
Norbert
Copy link to clipboard
Copied
Hello Stephen,
Many thanks for your help.
In the histogram panel I can only see the MB but not the MP.It's all a bit too complicated for me - sorry.
So I'll get some help and recommend your links.
Yes, triggering an action like this would be ideal.
CheersNorbert
By @norberta70820063
Mega pixels is total pixels divided by 1 million.
https://github.com/MarshySwamp/Report-Megapixel-Value/blob/main/Report%20Megapixel%20Value.jsx
https://prepression.blogspot.com/2018/03/photoshop-mega-pixel-value-script-mp.html?m=1
Copy link to clipboard
Copied
Yes, that's what I thought at first, that I would find the answer to my question in the histogram,
but unfortunately it works less for me than in your example.
I have just opened an image with the data width 3967 px x height 2945 px for testing.
According to my calculation, that's 11682815, but Photoshop shows 183024!
What should I make of this?
Copy link to clipboard
Copied
What is the file format?
Is the file flattened or layered?
Copy link to clipboard
Copied
no layer, psd, Adobe-RGB, 16bit
Copy link to clipboard
Copied
With the help of Rick Maschke, the problem is solved.