Working with bitmaps to a ZPL label printer
===

        Dim bitmapFilePath As String = imagepath here...
        Dim bitmapFileData As Byte() = System.IO.File.ReadAllBytes(bitmapFilePath)
        Dim fileSize As Integer = bitmapFileData.Length

        Dim bitmapDataOffset As Integer = 0
        Dim width As Integer = 50 '255
        Dim height As Integer = 50 '255
        Dim bitsPerPixel As Integer = 1
        Dim bitmapDataLength As Integer = 400
        Dim widthInBytes As Double = Math.Ceiling(width / 8.0)

        Dim bitmap(bitmapDataLength) As Byte
        Buffer.BlockCopy(bitmapFileData, bitmapDataOffset, bitmap, 0, bitmapDataLength)


        For i As Integer = 0 To bitmapDataLength Step 1
            bitmap(i) = bitmap(i) Xor &HFF

        Next

        Dim ZPLImageDataString As String = BitConverter.ToString(bitmap)
        ZPLImageDataString = Replace(ZPLImageDataString, "-", String.Empty)

        Dim zplCommand(3) As String

        zplCommand(0) = "^XA"
        zplCommand(1) = "^FO20,20"
        zplCommand(2) =
        "^GFA, " +
        bitmapDataLength.ToString() + "," +
        bitmapDataLength.ToString() + "," +
        widthInBytes.ToString() + "," +
        ZPLImageDataString

        zplCommand(3) = "^XZ"


It prints out a nonsense square that looks like someone applied the noise filter in Photoshop. I found this solution on the Zebra website, but that image was 255/255, I need this for a 50/50 image, but I have no idea what I'm supposed to change the offset to or the bitmapDatalength...