Forked from kennystrawnmusic/Invoke-AIPromptStego.ps1
Created
December 11, 2025 08:51
-
-
Save marcostolosa/63509852dc75cab4042593b3bc57ece0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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