Forked from jkone27/fshttpSpectreImageDownload.fsx
Created
September 2, 2024 22:43
-
-
Save jonas1ara/2f91a8baed5403b5e600463e80f03e76 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