This was inspired by this post which is about the serious business of website deployment in the Wolfram Cloud, and interaction with Google's reCaptcha system.
I started thinking of how to make those neat (and annoying) images that feature some variant of scrambled text that you have to type in to prove that you are human.
There are plenty of posts on the web about using Mathematica to beat captchas via OCR and wavelet transforms, here is an example.
This is what I've come up with (with a nod to kglr for showing how to grab the font information),
fontlist =
FE`Evaluate[FEPrivate`GetPopupList["MenuListFonts"]] /.
Rule[x_, y_] :> y;
effectslist = ImageEffect[];
captcha := With[{key = RandomChoice[WordList["CommonWords"], 2]},
Print@StringJoin@Riffle[key, " "];
With[{font = RandomChoice[fontlist]},
(Rotate[
Style[#, FontFamily -> font, RandomColor[]]
, RandomReal[{-.5, .5}]] &) /@ #] & /@
(Characters /@
key) // Grid // Rasterize[#, ImageSize -> 600] & //
ImageEffect[#, RandomChoice[effectslist]] &
]
It's limited to applying a different font to two different dictionary words and then giving each letter a random color and orientation, and finally applying an image transformation chosen from a non-exhaustive list. But I feel like the results are lacking, and they would be very easy to defeat via the methods described above:
Captchas I see on the web often use a swirling effect, or a rippling effect, and some nonlinear distortions, but I don't know how to do that in Mathematica
makeFourierSeriesApproximationManipulat
from Making Formulas… for Everything—From Pi to the Pink Panther to Sir Isaac Newton can be useful as well. I never used them, so can't make any more comment. $\endgroup$ – Sumit Apr 26 '16 at 13:54