How can I get the detail informations from a specific .png file in PowerShell?
Like dimensions, bit depth and size.
How can I get the detail informations from a specific .png file in PowerShell?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can get most of this information from the files extended properties like this:
You can also get the size in other ways such as
(Get-Item D:\image.png).Length / 1KB.The bit depth property doesn’t seem to be listed in the extended properties though even though its available when you right click the file.
Update Another option is to use .NET proper to avoid using COM:
Update 2 The PixelFormat property gives you the bit depth.
The property is an enumeration of possible formats. You can view the complete list here.
For example,
Format32bppArgbis defined as