Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

PowerShell script to read metadata info from pictures

$
0
0

Hi Guys,

I'm new to powershell scripts. I need a help with the below code:

Function Get-FileMetaData
{

Param([string[]]$folder)
foreach($sFolder in $folder)
{
$a = 0
$objShell = New-Object -ComObject Shell.Application
$objFolder = $objShell.namespace($sFolder)

foreach ($File in $objFolder.items())
{
$FileMetaData = New-Object PSOBJECT
for ($a ; $a -le 266; $a++)
{
if($objFolder.getDetailsOf($File, $a))
{
$hash += @{$($objFolder.getDetailsOf($objFolder.items, $a)) =
$($objFolder.getDetailsOf($File, $a)) }
$FileMetaData | Add-Member $hash
$hash.clear()
} #end if
} #end for
$a=0
$FileMetaData
} #end foreach $file
} #end foreach $sfolder
} #end Get-FileMetaData

$picdata = Get-FileMetaData -Folder 'C:\Users\mohad\Desktop\Shell\image' | select name, Dimensions, size, width, height
$picdata

My need is below:

1. I'm converting this code into exe, so the script should give info abt all the images from the folder in which it is started (the folder will always be named as "images" )
2. The result should be stored in a csv file name as "image data".
3. I want to extract additional info such as "horizontal/vertical resolution' of an image, color representation etc.

please help me!! TIA


Viewing all articles
Browse latest Browse all 6937

Trending Articles