Wolfram Archive
Wolfram Programming Lab is a legacy product.
All the same functionality and features, including access to Programming Lab Explorations, are available with Wolfram|One.
Start programming now. »
Try it now »
(no sign-in required)

Mirror Text

Create mirror-reflected text.

Run the code to make text large. Try different texts or different sizes:

SHOW/HIDE DETAILS

This is a text string. You can run it like any other code. The output doesnt have quotes, but its a string too:

"fish"

Use Style to change the styling of the text. This changes the size to 40 points (a point is a unit used by printers, equal to 1/72 inch):

Style["fish", 40]

HIDE DETAILS
Style["my name here", 40]

Turn the text into an image, then reflect it. Try directions other than LeftRightfor example, TopBottom:

SHOW/HIDE DETAILS

When you run this code, the output is text. You can tell its text because you can select parts of it by dragging:

Style["fish", 40]

This output looks like text, but its actually an imagea picture of the text. You can tell its an image because when you click it, you get an orange frame. Rasterize turns text (and other things) into images:

Rasterize[Style["fish", 40]]

If you click the image and drag one of the handles to make it bigger, you can see the individual pixels:

Once youve turned text into an image, you can apply image operations to it. This reflects the text to turn it into mirror-writing:

ImageReflect[Rasterize[Style["my name here", 40]], Left -> Right]

HIDE DETAILS
ImageReflect[Rasterize[Style["my name here", 40]], Left -> Right]

Change the font family. Try other font familiesfor example, "Arial" or "Impact":

SHOW/HIDE DETAILS

Write text in different fonts by specifying the font family:

Style["fish", 40, FontFamily -> "Comic Sans MS"]

Heres the same text in a different font:

Style["fish", 40, FontFamily -> "Times"]

HIDE DETAILS
ImageReflect[ Rasterize[Style["my name here", 40, FontFamily -> "Comic Sans MS"]], Left -> Right]

Share Itmake a website that mirrors text you type in:

SHOW/HIDE DETAILS

Deploy a form that asks for some text and then displays it mirrored:

CloudDeploy[ FormFunction[{{"text", "text to mirror"} -> "String"}, ImageReflect[Rasterize[Style[#text, 100, FontFamily -> "Times"]], Left -> Right] &, "PNG" ], Permissions -> "Public" ]

Click the link in the output to visit the site.

Tell the world about your creation by sharing the link via email, tweet or other message.

HIDE DETAILS
CloudDeploy[ FormFunction[{{"text", "text to mirror"} -> "String"}, ImageReflect[Rasterize[Style[#text, 100, FontFamily -> "Times"]], Left -> Right] &, "PNG" ], Permissions -> "Public" ]