Skip to content

Instantly share code, notes, and snippets.

@jkone27
Created January 22, 2024 11:29
Show Gist options
  • Save jkone27/2490d1213ae1274568c08ffe949b6973 to your computer and use it in GitHub Desktop.
Save jkone27/2490d1213ae1274568c08ffe949b6973 to your computer and use it in GitHub Desktop.
download an image and display it in your console with fshttp and spectre.console packages in fsx F# script
#r "nuget: FsHttp"
#r "nuget: Spectre.Console.ImageSharp"
open FsHttp
open Spectre.Console
let imgUrl =
"https://banner2.cleanpng.com/20200525/frt/transparent-hero-image-hero-logo-cartoon-5ecc928ba8c9a0.2212187815904651636914.jpg"
let str = http { GET imgUrl } |> Request.send |> Response.toStream
let image =
let i = new CanvasImage(data = str)
i.MaxWidth <- 64
i
AnsiConsole.Write(image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment