Convert Image Local Path to Base64?

How can I easily convert Image Local Path to Base64 in uipath ?
Thanks !

1 Like

Hi @Anh_Nguyen

kindly refer the below thread

or use

Assign
strvar=Convert.ToBase64String(image)

Thanks

Hey @Anh_Nguyen

Please find the below,

In the Assign statement

strImg = Convert.ToBase64String(System.IO.File.ReadAllBytes("image file path"))

Hope this helps

Thanks
#nK

2 Likes

thanks for taking time , guys . But I have problem when I get base 64 successfully and try to convert back to my original image , I see that I lost a part of image . Idk . Please check pictures below

pic 1 : Image What I will get base 64 => My base 64 :
base64.docx (35.4 KB)

pic 2 : Image What I try to convert back.

2 Likes

Hey @Anh_Nguyen

Where are you pasting this B64 image ?

Check if the element or container size is smaller or so than image.

Else, you may need to resize it to the required dimensions before the B64 conversion.

Thanks
#nK

I use this link to gen B64

Beside , I check size of my images : 100 KBs → 500 KBs . If I need to resize image , How I will do it ? . Thanks

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.