first commit
This commit is contained in:
+52
@@ -0,0 +1,52 @@
|
||||
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()
|
||||
|
||||
Write-Host "=== Measuring 1.png ($w x $h) ==="
|
||||
|
||||
# Manually check specific pixels to find exact boundaries
|
||||
Write-Host "`nSlot 1 - around Y=180:"
|
||||
$y = 180
|
||||
for ($x = 70; $x -le 520; $x += 50) {
|
||||
$i = ($y * $stride) + ($x * 4)
|
||||
$b = $bytes[$i]
|
||||
$g = $bytes[$i + 1]
|
||||
$r = $bytes[$i + 2]
|
||||
$char = if ($r -gt 200 -and $g -gt 200 -and $b -gt 200) { "█" } else { "." }
|
||||
Write-Host " x=$x : $char RGB($r,$g,$b)"
|
||||
}
|
||||
|
||||
Write-Host "`nSlot 2 - around Y=700:"
|
||||
$y = 700
|
||||
for ($x = 70; $x -le 520; $x += 50) {
|
||||
$i = ($y * $stride) + ($x * 4)
|
||||
$b = $bytes[$i]
|
||||
$g = $bytes[$i + 1]
|
||||
$r = $bytes[$i + 2]
|
||||
$char = if ($r -gt 200 -and $g -gt 200 -and $b -gt 200) { "█" } else { "." }
|
||||
Write-Host " x=$x : $char RGB($r,$g,$b)"
|
||||
}
|
||||
|
||||
Write-Host "`nSlot 3 - around Y=1200:"
|
||||
$y = 1200
|
||||
for ($x = 70; $x -le 520; $x += 50) {
|
||||
$i = ($y * $stride) + ($x * 4)
|
||||
$b = $bytes[$i]
|
||||
$g = $bytes[$i + 1]
|
||||
$r = $bytes[$i + 2]
|
||||
$char = if ($r -gt 200 -and $g -gt 200 -and $b -gt 200) { "█" } else { "." }
|
||||
Write-Host " x=$x : $char RGB($r,$g,$b)"
|
||||
}
|
||||
Reference in New Issue
Block a user