Hello,
I need to convert a base64 string to a jpg file.
I'm using wpf in Visual Cobol.
Thanks
Alberto Ferraz
Hello,
I need to convert a base64 string to a jpg file.
I'm using wpf in Visual Cobol.
Thanks
Alberto Ferraz
Hello,
I need to convert a base64 string to a jpg file.
I'm using wpf in Visual Cobol.
Thanks
Alberto Ferraz
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).
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).
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
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.