base64

Convert image header information to ASCII code

Convert image header information to ASCII code Question: I got a string with image header information like pixel number for each dimension. Here the header: "1 10 10 1 4 LE". In addition to that the other image data is saved in the following base64 code: "+igSKdAm9CVoJhYnzidqKLsmnyX2JwQo9CYhJgMmaCb5Jo0nMSevJmAnwibIJuEmnyZRJpomNicxJ9gmfSeoJkcmySZAJ/Am2CZZJ78nOSeUJ7km+CWVJpMnyCebJ6UnoiclJ7UmPyY3JgsnwyfGJ7cniSdlJ3oneSajJi8n3ye5Jz4nvCeMJ1onYSdAJ3QnsScLKHsnTCfuJ6MnGCdaJ2onECfUJmcnhicEKAko9yZPJjYn0SY7JmkmKid3J1goDyhOJrIldic=". I tried to combine these two strings to …

Total answers: 1

Hash a column in CSV and output in Base64

Hash a column in CSV and output in Base64 Question: Still getting my feet wet with Python, but my goal is to read a CSV file and hash a specific column using SHA256 then output in Base64. Here is an example of the conversion that needs to take place This calculator can be found at …

Total answers: 2

How to decode a base64 encoded string returned from an api correctly

How to decode a base64 encoded string returned from an api correctly Question: Having a base64 string encoded JSON like object coming from a python API, what is the correct way to decode and parse the encoded JSON in javascript? Python makes it a byte string literal by adding b prefix and additional apostrophes. I …

Total answers: 1

Encode a column in CSV to Base64

Encode a column in CSV to Base64 Question: I’ll preface by saying I’m a novice with Python, but I’m trying to encode a single column from a CSV to Base64 and write to another CSV. The file has 3 columns (consumer_id, sms_number, email_address) and I only want to encode the ‘consumer_id’. Here is what I …

Total answers: 1

Is there any way to remove the b'' from decoded base64 output?

Is there any way to remove the b'' from decoded base64 output? Question: When i run import base64 a = "aHR0cHM6Ly9kaXNjb3JkLmNvbS9hcGkvd2ViaG9va3MvMTA2MTQ2NzIxNDI2MTI2MDMwOC9wNklOLWgzVkRGSEo1UVIyNDVSXy1NUFlWZ2xfU2tRZ3RUemVPMUN2SGlUZlBSMEExSjhOQUdHVmt0NU1sZzhrYXVkRg==" hook = base64.b64decode(a) print(hook) It returns: b’https://discord.com/api/webhooks/1061467214261260308/p6IN-h3VDFHJ5QR245R_-MPYVgl_SkQgtTzeO1CvHiTfPR0A1J8NAGGVkt5Mlg8kaudF’ But i want it to only return https://discord.com/api/webhooks/1061467214261260308/p6IN-h3VDFHJ5QR245R_-MPYVgl_SkQgtTzeO1CvHiTfPR0A1J8NAGGVkt5Mlg8kaudF not the b”. Is there anyway to fix the problem? I know it says it because the type is …

Total answers: 1

Read video from base64 in python

Read video from base64 in python Question: I would like to process a video that I receive through an upload component in plotly dash. Currently I am creating a tempfile and then reading the video with opencv. However, I would like to avoid writing the file to disk. Is there a way to process the …

Total answers: 1

the output in python base64.b64decode doesn't match java's decode Base64

the output in python base64.b64decode doesn't match java's decode Base64 Question: I’m trying to refactor some scala code to python3. Currently stuck at decoding a string in base64. The output from Python’s base64.b64decode does not match the Scala’s output. Scala: import org.apache.commons.codec.binary.Base64.decodeBase64 val coded_str = "UgKgDwhoEAAANAEA1tYAADABABoBABMAAAAAAQAAAAEAAQACAAAAAAD6sT4AO0YAAA==" decodeBase64(coded_str) //Output 1 : res1: Array[Byte] = Array(82, 2, …

Total answers: 2

Difficulty decoding image with base64 library

Difficulty decoding image with base64 library Question: I’m having trouble decoding an image when I import it from another file. I have four .py files to make two buttons. In the first, on line 21, the button works and brings the image, in the second, on line 28, which is imported from another file, it …

Total answers: 1