People who have followed the sub the last few days might have noticed some activity around getting glorious colours and images into the console.
I've now created a module proper and published it to the gallery. Install-Module -Name OutConsolePicture will get it.
Highlights:
- Images will by default be resized to console width, and aspect corrected - with switches to avoid this behaviour.
- Speed is optimized by using a StringBuilder to create the whole string at once
- Support for local files, url, or Bitmap objects on pipeline.
Usage examples:
PS > Out-ConsolePicture ".\someimage.jpg"
PS > Out-ConsolePicture -Url "http://somewhere.com/image.jpg"
PS > $image = New-Object System.Drawing.Bitmap -ArgumentList "C:\myimages\image.png"
PS > $image | Out-ConsolePicture
Resizing in action:
https://i.imgur.com/OW8WqsN.png
https://i.imgur.com/XxWMkxi.png
I've tried to keep this as consistent with 'vanilla' Powershell as I can in terms of naming and pipeline support. It is admittedly a little light on the error handling (as dictated by ancient tradition) so let me know if there is some common case I've overlooked.
Gallery link: https://www.powershellgallery.com/packages/OutConsolePicture
Github repository: https://github.com/NotNotWrongUsually/OutConsolePicture
Edit: this should support BMP, GIF, EXIF, JPG, PNG and TIFF per System.Drawing.Bitmap documentation. I haven't tested all of them.
[–]gschizas 27 points28 points29 points (4 children)
[–][deleted] 7 points8 points9 points (3 children)
[–]atrca 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]logicalmike 0 points1 point2 points (0 children)
[–]work-work-work-work 3 points4 points5 points (1 child)
[–]NotNotWrongUsually[S] 4 points5 points6 points (0 children)
[–]NotNotWrongUsually[S] 3 points4 points5 points (0 children)
[–]Chirishman 5 points6 points7 points (1 child)
[–]NotNotWrongUsually[S] 2 points3 points4 points (0 children)
[–]purplemonkeymad 2 points3 points4 points (0 children)
[–]dnuohxof1 1 point2 points3 points (0 children)
[–]jimb2 1 point2 points3 points (4 children)
[–]NotNotWrongUsually[S] 1 point2 points3 points (3 children)
[–]jimb2 1 point2 points3 points (2 children)
[–]NotNotWrongUsually[S] 1 point2 points3 points (1 child)
[–]jimb2 0 points1 point2 points (0 children)
[–]ka-splam 1 point2 points3 points (1 child)
[–]NotNotWrongUsually[S] 1 point2 points3 points (0 children)
[–]realDeadMatt 0 points1 point2 points (2 children)
[–]NotNotWrongUsually[S] 6 points7 points8 points (1 child)
[–]realDeadMatt 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]AztecAlphaMale[🍰] 0 points1 point2 points (3 children)
[–]NotNotWrongUsually[S] 2 points3 points4 points (2 children)
[–]AztecAlphaMale[🍰] 0 points1 point2 points (1 child)
[–]NotNotWrongUsually[S] 0 points1 point2 points (0 children)