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 "=== Finding exact slot boundaries in 1.png ===" # Slot 1: should be around Y 178-457 Write-Host "`n=== SLOT 1 ===" $minX = 600; $maxX = 0; $minY = 1800; $maxY = 0 for ($y = 160; $y -lt 470; $y++) { for ($x = 80; $x -lt 530; $x++) { $i = ($y * $stride) + ($x * 4) $b = $bytes[$i]; $g = $bytes[$i + 1]; $r = $bytes[$i + 2] if ($r -gt 230 -and $g -gt 200 -and $b -gt 200) { if ($x -lt $minX) { $minX = $x } if ($x -gt $maxX) { $maxX = $x } if ($y -lt $minY) { $minY = $y } if ($y -gt $maxY) { $maxY = $y } } } } Write-Host "Bounds: X=$minX-$maxX (width=$([math]::abs($maxX - $minX))), Y=$minY-$maxY (height=$([math]::abs($maxY - $minY)))" Write-Host "CSS: x: $minX, y: $minY, width: $([math]::abs($maxX - $minX)), height: $([math]::abs($maxY - $minY))" # Slot 2: should be around Y 615-894 Write-Host "`n=== SLOT 2 ===" $minX = 600; $maxX = 0; $minY = 1800; $maxY = 0 for ($y = 595; $y -lt 920; $y++) { for ($x = 80; $x -lt 530; $x++) { $i = ($y * $stride) + ($x * 4) $b = $bytes[$i]; $g = $bytes[$i + 1]; $r = $bytes[$i + 2] if ($r -gt 230 -and $g -gt 200 -and $b -gt 200) { if ($x -lt $minX) { $minX = $x } if ($x -gt $maxX) { $maxX = $x } if ($y -lt $minY) { $minY = $y } if ($y -gt $maxY) { $maxY = $y } } } } Write-Host "Bounds: X=$minX-$maxX (width=$([math]::abs($maxX - $minX))), Y=$minY-$maxY (height=$([math]::abs($maxY - $minY)))" Write-Host "CSS: x: $minX, y: $minY, width: $([math]::abs($maxX - $minX)), height: $([math]::abs($maxY - $minY))" # Slot 3: should be around Y 1052-1331 Write-Host "`n=== SLOT 3 ===" $minX = 600; $maxX = 0; $minY = 1800; $maxY = 0 for ($y = 1030; $y -lt 1360; $y++) { for ($x = 80; $x -lt 530; $x++) { $i = ($y * $stride) + ($x * 4) $b = $bytes[$i]; $g = $bytes[$i + 1]; $r = $bytes[$i + 2] if ($r -gt 230 -and $g -gt 200 -and $b -gt 200) { if ($x -lt $minX) { $minX = $x } if ($x -gt $maxX) { $maxX = $x } if ($y -lt $minY) { $minY = $y } if ($y -gt $maxY) { $maxY = $y } } } } Write-Host "Bounds: X=$minX-$maxX (width=$([math]::abs($maxX - $minX))), Y=$minY-$maxY (height=$([math]::abs($maxY - $minY)))" Write-Host "CSS: x: $minX, y: $minY, width: $([math]::abs($maxX - $minX)), height: $([math]::abs($maxY - $minY))"