Skip to content

Instantly share code, notes, and snippets.

@kennystrawnmusic
Last active December 11, 2025 08:51
Show Gist options
  • Select an option

  • Save kennystrawnmusic/44381e06bed0a355234c65528259a4e8 to your computer and use it in GitHub Desktop.

Select an option

Save kennystrawnmusic/44381e06bed0a355234c65528259a4e8 to your computer and use it in GitHub Desktop.
function Invoke-AIPromptStego {
param(
[string]$InFile,
[string]$OutFile,
[string]$OutFormat,
[string]$Prompt
)
Add-Type -AssemblyName System.Drawing
$bytes = [System.IO.File]::ReadAllBytes($InFile)
$bytes += [System.Text.Encoding]::UTF8.GetBytes([char[]]($Prompt))
$b64prompt = [System.Convert]::ToBase64String($bytes)
$binprompt = [System.Convert]::FromBase64String($b64prompt)
$stream = New-Object System.IO.MemoryStream($binprompt.Length)
$stream.Write($binprompt, 0, $binprompt.Length)
$stream.Position = 0
$img = [System.Drawing.Image]::FromStream($stream, $true, $false)
$img.Save($OutFile, [System.Drawing.Imaging.ImageFormat]::$OutFormat)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment