What is Trash PaNDA?
Trash PaNDA is a tool to mask text from your images using SixLabors' ImageSharp and Microsoft's Computer Vision API.
Think of it as an automated redaction tool - just like you see with the odd Government report or statement. I initially designed it to be used to mask client names from screenshots of my code and tool windows, to comply with non-disclosure agreements (NDAs).
How do I use it?
Download with Chocolatey:
choco install trashpanda
Use in your own projects with Nuget:
Or check out the Releases tab for nightlies.
- Download, build the src\TrashPaNDA\TrashPaNDA.csproj.
- Call TrashPandaHelper.ReplaceWordsInImage():
string apiKey- your Cognitive Services API key;
byte originalImage- your original image stream in a byte array (ImageSharp will handle PNG, JPEG, GIF and BMP);
string wordsToReplace- an array of words to replace (case-insensitive);
int scaleUp- an optional scale factor to improve text recognition (leave as 1 & it'll scale automatically);
- 'string endpoint' - optional, used to specify a specific Computer Vision API endpoint URI (see here for a list of acceptable endpoints)
- Do what you want with the resulting
byte- MemoryStream, save to file, etc.
PR's always accepted!
ImageSharp is licensed under an Apache 2.0 License.
Microsoft Cognitive Services API is licensed under an MIT License.
The Trash PaNDA logo is courtesy of Danielle Papanikolaou under the Pixabay License.