#!/bin/bash
# NVM needs the ability to modify your current shell session's env vars,
# which is why it's a sourced function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data:image/gif;base64,R0lGODlhAQABAAAAACw= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
import base64 | |
image = "" # raw data with base64 encoding | |
decoded_data = base64.b64decode(image) | |
np_data = np.fromstring(decoded_data,np.uint8) | |
img = cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED) | |
cv2.imshow("test", img) | |
cv2.waitKey(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const blobToImage = (blob) => { | |
return new Promise(resolve => { | |
const url = URL.createObjectURL(blob) | |
let img = new Image() | |
img.onload = () => { | |
URL.revokeObjectURL(url) | |
resolve(img) | |
} | |
img.src = url | |
}) |