Created
July 21, 2021 15:05
-
-
Save dpiponi/3abef1f9d18f7d648aed2480969fe148 to your computer and use it in GitHub Desktop.
This file contains 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
(** User Mathematica initialization file **) | |
(** See https://reference.wolfram.com/language/tutorial/ConfigurationFiles.html for info on instaling this file **) | |
(** Display graphics inline in iTerm2. I don't know an easy way to test if we're running in iTerm2 without looking at the process table. **) | |
imgcat[image_Graphics]:=( | |
WriteString[$Output, "\033]1337;File=inline=1:"<>ExportString[ExportString[image,"PNG"],"Base64"]<>"\007"]; | |
Null | |
) | |
(** `ListAnimate` seems to work but `Animate` doesn't. **) | |
imgcat[image_Manipulate]:=( | |
WriteString[$Output, "\033]1337;File=inline=1:"<>ExportString[ExportString[image,"GIF"],"Base64"]<>"\007"]; | |
Null | |
) | |
imgcat[other_]:=other | |
$Post=imgcat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This allows Mathematica to inline images when Wolframscript is used from the iTerm2 terminal on macOS.