Redacting craiyon prompts with imagemagick
22 June 22
Iāve been messing around with craiyon (formerly DALL-E mini), because who hasnāt been doing that recently.
As part of a workshop Iām running soon at the School of Cybernetics I need to provide āredactedā versions of the classic 3x3 craiyon output imageāand I need to do it for quite a few outputs.
Because itās tedious to do that by hand, hereās what I came up with:
-
input a prompt and generate the craiyon output as normal
-
use the š· Screenshot button to get a nice, clean screenshot
-
run this imagemagick command (in my case the downloaded screenshot name was
craiyon_2022-6-22_17-21-5.webp, yours will be similar but with a different timestamp at the end)convert craiyon_2022-6-22_17-21-5.webp -fill red -draw 'rectangle 30, 240, 1320, 320' -fill white -pointsize 50 -gravity north -annotate +0+250 'REDACTED' craiyon_2022-6-22_17-21-5-redacted.webp -
(bonus round) if you want to loop over a bunch of files and do it in batch, I did that in Emacs with:
(--each (f-entries "." (lambda (s) (s-ends-with? "png" s))) (shell-command (format "convert %s -fill red -draw 'rectangle 30, 240, 1320, 320' -fill white -pointsize 50 -gravity north -annotate +0+250 'REDACTED' redacted-%s.webp" it (f-base it))))
#An example
Hereās an example screenshot:

and the same output, after the redaction command has been run:

If you need to do the same, then hopefully Iāve saved you a bit of time āŗ
Cite this post
@online{swift2022redactingCraiyonPromptsWithImagemagick,
author = {Ben Swift},
title = {Redacting craiyon prompts with imagemagick},
url = {https://benswift.me/blog/2022/06/22/redacting-craiyon-prompts-with-imagemagick/},
year = {2022},
month = {06},
note = {AT-URI: at://did:plc:tevykrhi4kibtsipzci76d76/site.standard.document/2022-06-22-redacting-craiyon-prompts-with-imagemagick},
}