- 655 名前:デフォルトの名無しさん mailto:sage [2022/02/06(日) 05:53:39.32 ID:ZVoj0wBD.net]
- Param([Parameter(mandatory=$true)][String]$inputFile)
Add-Type -AssemblyName "System.Drawing" try{ $img = [System.Drawing.Image]::FromFile($inputFile) if ($img.RawFormat.Equals([System.Drawing.Imaging.ImageFormat]::Jpeg)) { $mimetype = 'image/jpeg' } elseif ($img.RawFormat.Equals([System.Drawing.Imaging.ImageFormat]::Png)) { $mimetype = 'image/png' } elseif ($img.RawFormat.Equals([System.Drawing.Imaging.ImageFormat]::Bmp)) { $mimetype = 'image/bmp' } elseif ($img.RawFormat.Equals([System.Drawing.Imaging.ImageFormat]::Gif)) { $mimetype = 'image/gif' } elseif ($img.RawFormat.Equals([System.Drawing.Imaging.ImageFormat]::Icon)) { $mimetype = 'image/icon' } elseif ($img.RawFormat.Equals([System.Drawing.Imaging.ImageFormat]::Tiff)) { $mimetype = 'image/tiff' } elseif ($img.RawFormat.Equals([System.Drawing.Imaging.ImageFormat]::Wmf)) { $mimetype = 'image/wmf' } elseif ($img.RawFormat.Equals([System.Drawing.Imaging.ImageFormat]::Exif)) { $mimetype = 'image/exif' } else { $mimetype = 'image/unknown' } $w = $img.Width $h = $img.Height $img.Dispose() } catch{ $mimetype='unknown' } echo "$mimetype`t$w`t$h"
|

|