Skip to content

An extension for PodNet.Boxify that wraps System.Drawing.Bitmap for drawing box-drawings of images to text, files or terminals

License

Notifications You must be signed in to change notification settings

podNET-Hungary/PodNet.Boxify.Bmp

Repository files navigation

PodNet.Boxify.Bmp NuGet

An extension for PodNet.Boxify that wraps System.Drawing.Bitmap for drawing box-drawings of images to text, files or terminals

Usage

This NuGet package contains a simple implementation of PodNet.Boxify's IBoxBitmapSource, that wraps a System.Drawing.Bitmap from System.Drawing.Common.

This is only used to provide the bridge between PodNet.Boxify and a commonly used bitmap source, but you should consider implementing IBoxBitmapSource yourself if you already have an image representation in your application to avoid taking a dependency on another image manipulation library.

var bmp = new Bitmap("mybmp.bmp");
using var source = new BitmapSource(bmp);
var boxArt = Renderer.Default.Render(source, PixelPalette.Halves);

There are no additional options for resizing, colorizing or applying effects. Do note that the renderer will render a character for each pixel into the resulting string, so any additional image manipulation you have to do yourself prior to rendering to the string (or do the manipulation, specifically the resizing and transformations in your custom wrapper).

For details on how to use PodNet.Boxify, see the repo at https://github.com/podNET-Hungary/PodNet.Boxify/.

This package is also required by v1.0.0 PodNet.Boxify.Svg that allows converting SVG vector-based images to bitmaps so that they can in turn be converted to box-drawings. v1.0.1 onwards this dependency was removed. You can still use this library (and v1.0.0 of the SVG companion) if it suits your needs, especially if you already use System.Drawing.Common. However, if you're using another library, like SkiaSharp, ImageSharp or any others, you should supply your own simple implementation for the IBoxBitmapSource (it should simply wrap an object an proxy the Width, Height and GetPixel(int x, int y) calls to it, see BitmapSource.cs for reference).

Contributing and Support

This project is intended to be widely usable, but no warranties are provided. If you want to contact us, feel free to do so in the org's [Discussions], at our website at podnet.hu, or find us anywhere from LinkedIn to Meetup, YouTube or X.

Any kinds of contributions from issues to PRs and open discussions are welcome!

Don't forget to give us a ⭐ if you like this repo (it's free to give kudos!) or share it on socials!

Sponsorship

If you're using our work or like what you see, consider supporting us. Every bit counts. 🙏 See here for more info.

About

An extension for PodNet.Boxify that wraps System.Drawing.Bitmap for drawing box-drawings of images to text, files or terminals

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages