image-watcher
Display an image and update it when the file changes.
$ image-watcher --help
Usage: image-watcher FILE
Display an image and update it when the file changes
Available options:
FILE Image file to watch and display
-h,--help Show this help text
Especially useful in combination with a program like ghcid or fswatcher which runs a command when your code changes. Write a function which renders your image description to a file, and configure that program to run that function whenever you edit that image description. Tada! You now have a live preview for that image description.
For completeness, here's the code I use in the above demo.
import Diagrams.Prelude
import Diagrams.Backend.Cairo.CmdLine
import System.Environment
myDiagram :: Diagram B
myDiagram = circle 180 # fc aliceblue
main :: IO ()
main = do
withArgs ["--output", "out.png"] $ do
mainWith myDiagram
I then use vim
in one terminal, ghcid --test=main
in the other, and image-watcher out.png
in the background.