getting camera info from bath file?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
tcpman
Posts: 53
Joined: 05 Mar 2014 15:01

getting camera info from bath file?

#1 Post by tcpman » 19 May 2015 12:49

as many of you guys know when we take a picture with our camera and then send it to our computer if we open the propertes
we can see the model and the company name of the camera!
now i want to save this model and company name into a text file
but i just dont know how!
i though it will be possible using wmic to get the info i need but i did not see anything in wmic helps that can do this job
so i want to ask is this possible to do?
its okey if i can use poweshell or vbs just want to do it using a script

penpen
Expert
Posts: 1864
Joined: 23 Jun 2013 06:15
Location: Germany

Re: getting camera info from bath file?

#2 Post by penpen » 19 May 2015 13:52

The ExifTool may help you:
http://www.sno.phy.queensu.ca/~phil/exiftool/.


penpen

tcpman
Posts: 53
Joined: 05 Mar 2014 15:01

Re: getting camera info from bath file?

#3 Post by tcpman » 21 May 2015 09:44

well i am still looking for a way using vbs,cmd,powershell
but if no luck then i will use this
tnx my friend.

Compo
Posts: 505
Joined: 21 Mar 2014 08:50

Re: getting camera info from bath file?

#4 Post by Compo » 21 May 2015 16:25

tcpman wrote:well i am still looking for a way using vbs,cmd,powershell

Here's all I'm willing to provide: (this isn't a powershell group)

Get-ImgCamNfo.ps1

Code: Select all

param([string]$path = (get-location), 
    [string]$fileType = ".jpg")
clear
Add-Type -AssemblyName System.Drawing
$filter = "*" + $fileType
$Encode = new-object System.Text.ASCIIEncoding
$files = get-childitem -recurse $path -filter $filter
$image = $null
$filesource = $null
if ($files -ne $null)
{
    foreach ($file in $files)
    {
        $image = [System.Drawing.Imaging.Metafile]::FromFile($file.FullName)
        try
        {
            $filesource = $image.GetPropertyItem(41728).Value[0]
            $makerByte = $image.GetPropertyItem(271)
            $imageMaker = $Encode.GetString($makerByte.Value)
            $modelByte = $image.GetPropertyItem(272)
            $imageModel = $Encode.GetString($modelByte.Value)
            $image.Dispose()   
        }
        catch
        {
        }
        if(($filesource -eq 3) -and ($imageMaker -ne $null) -and ($imageModel -ne $null))
        {
            write $file.fullname $imageMaker $imageModel `r`n
        }
    }
}
else
{
    Write-Host "No files found"
}
You should run it in the ISE with a command such as:

Code: Select all

.\Get-ImgCamNfo.ps1 -path F:\Data\MyPics -fileType .jpg
...obviously change the top level directory and file extension to suit your specific task.

tcpman
Posts: 53
Joined: 05 Mar 2014 15:01

Re: getting camera info from bath file?

#5 Post by tcpman » 22 May 2015 09:15

thank you !
you saved my day!

Endoro
Posts: 244
Joined: 27 Mar 2013 01:29
Location: Bozen

Re: getting camera info from bath file?

#6 Post by Endoro » 24 May 2015 20:03

Compo wrote:Here's all I'm willing to provide: (this isn't a powershell group)

So please do not provide Powershell code here, except in hybrid cmd shell command files.
Thank you

Compo
Posts: 505
Joined: 21 Mar 2014 08:50

Re: getting camera info from bath file?

#7 Post by Compo » 25 May 2015 03:06

Endoro wrote:
Compo wrote:Here's all I'm willing to provide: (this isn't a powershell group)

So please do not provide Powershell code here, except in hybrid cmd shell command files.
Thank you

How ironic that three days after my solution and its subsequent acknowledgement that you should highlight the pointlessness of my content!

Post Reply