How convert base64 to a jpg file

Hello,

I need to convert a base64 string to a jpg file. 

I'm using wpf in Visual Cobol.

Thanks

Alberto Ferraz

Parents
  • If you are using .NET framework then it should be straight forward:

    method-id Base64ToJpg (targetJpgPath as string, base64string as string).
    declare imageBytes = type Convert::FromBase64String(base64string)
    invoke type File::WriteAllBytes(targetJpgPath, imageBytes)
    end method.

    Assuming your base64 string is representing a JPEG blob. If it is another image format such as .png or .bmp then you will need to convert it first (you can do this using the Bitmap class in System.Drawing).

  • Verified Answer

    Hi Ted,

    Thank you for the tip, it works well.

    I can convert the Base64 image and save it in jpg.

    Best regards

    Alberto Ferraz

     

     

Reply Children
No Data