Skip to main content
Inspiring
October 14, 2024
Answered

Total number of pixels

  • October 14, 2024
  • 3 replies
  • 2255 views

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

 

This topic has been closed for replies.
Correct answer norberta70820063

no layer, psd, Adobe-RGB, 16bit


With the help of Rick Maschke, the problem is solved.

https://www.youtube.com/watch?v=eGE0kJhE-0s

3 replies

D Fosse
Community Expert
Community Expert
October 14, 2024

What am I missing? Why is a script necessary to multiply w x h?

Stephen Marsh
Community Expert
Community Expert
October 14, 2024
quote

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.

D Fosse
Community Expert
Community Expert
October 14, 2024

@Stephen Marsh 

Oh, OK. Knew there was something... 😉

Legend
October 14, 2024

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);
    }
Inspiring
October 14, 2024

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

Legend
October 14, 2024

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.

Stephen Marsh
Community Expert
Community Expert
October 14, 2024

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?

Inspiring
October 14, 2024

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

Stephen Marsh
Community Expert
Community Expert
October 14, 2024
quote

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