How to convert base64 string to image using vb.net

39 Views Asked by At

I am working on an application where I am working on Image processing I am getting a signature from a third party in a base64 string and it's a PNG when I load the signature on the report it shows the signature in jpg with a black background. I need to set the background of the image.

   mLastSignature = result.transactionResponse.signature
   PictureBox1.Image = ToImage



Public Property ToImage() As System.Drawing.Image Implements ISigCapture.ToImage
      Get
          If mPaymentSubType = "EmergePay" Then
              Dim arr = Convert.FromBase64String(mLastSignature)
              Dim img = New Bitmap(New MemoryStream(arr))
              Return img
          End If

          Dim tempFilename = System.IO.Path.GetTempFileName()
          easyIntegrator.utilities.SaveSignatureAsJPG(mLastSignature, tempFilename)
          Dim image = New Bitmap(tempFilename)
          'System.IO.File.Delete(tempFilename)
          Return image
      End Get
      Set(ByVal value As System.Drawing.Image)
          PictureBox1.Image = value
      End Set
  End Property
0

There are 0 best solutions below