Created
January 22, 2024 11:29
-
-
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
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
#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