Skip to content

Plot: GetImageBytes() #1107

@swharden

Description

@swharden

For cloud applications we need to convert a Bitmap to byte[] to save into blob storage.

This requires interacting with System.Drawing.Common, which means taking that dependency on in the cloud app.

The Plot module should have a GetBitmapBytes() that lets you specify file format type, preventing the need to pass Bitmap objects around in the cloud

public static byte[] GetBytesPng(System.Drawing.Bitmap bmp)
{
    using MemoryStream stream = new();
    bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
    return stream.ToArray();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions