first commit
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
Add-Type -AssemblyName PresentationCore,WindowsBase
|
||||
|
||||
$path = 'c:\Users\Administrator\Documents\PaaS\photobooth\src\assets\1.png'
|
||||
$fs = [System.IO.File]::OpenRead($path)
|
||||
$decoder = [System.Windows.Media.Imaging.BitmapDecoder]::Create(
|
||||
$fs,
|
||||
[System.Windows.Media.Imaging.BitmapCreateOptions]::None,
|
||||
[System.Windows.Media.Imaging.BitmapCacheOption]::OnLoad
|
||||
)
|
||||
$frame = $decoder.Frames[0]
|
||||
$w = $frame.PixelWidth
|
||||
$h = $frame.PixelHeight
|
||||
$stride = $w * 4
|
||||
$bytes = New-Object byte[] ($stride * $h)
|
||||
$frame.CopyPixels($bytes, $stride, 0)
|
||||
$fs.Close()
|
||||
|
||||
# Check what colors are actually in the second slot area
|
||||
Write-Host "Sampling SLOT 2 area (Y 600-700, X 80-530):"
|
||||
for ($y = 600; $y -le 700; $y += 25) {
|
||||
$colors = @()
|
||||
for ($x = 150; $x -le 450; $x += 50) {
|
||||
$i = ($y * $stride) + ($x * 4)
|
||||
$b = $bytes[$i]; $g = $bytes[$i + 1]; $r = $bytes[$i + 2]
|
||||
$colors += "R=$r"
|
||||
}
|
||||
Write-Host "Y=$y : $($colors -join ' | ')"
|
||||
}
|
||||
Reference in New Issue
Block a user