
Add-Type -AssemblyName System.Drawing

$sourcePath = "c:\Users\kaneo\Projects\truth-lens\extension\public\icons\icon128.png"
$destPath = "c:\Users\kaneo\Projects\truth-lens\extension\public\icons\icon32.png"

try {
    $image = [System.Drawing.Image]::FromFile($sourcePath)
    $bitmap = new-object System.Drawing.Bitmap(32, 32)
    $graphics = [System.Drawing.Graphics]::FromImage($bitmap)
    $graphics.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
    $graphics.DrawImage($image, 0, 0, 32, 32)
    $bitmap.Save($destPath, [System.Drawing.Imaging.ImageFormat]::Png)
    
    $image.Dispose()
    $bitmap.Dispose()
    $graphics.Dispose()
    
    Write-Host "Successfully created icon32.png"
} catch {
    Write-Error "Failed to resize image: $_"
    exit 1
}
