(a)
| 12 | a.shape]) |
| 13 | |
| 14 | def base64_decode_image(a): |
| 15 | # grab the array, data type, and shape from the JSON-decoded object |
| 16 | (a, dtype, shape) = json.loads(a) |
| 17 | |
| 18 | # if this is Python 3, then we need the extra step of encoding the |
| 19 | # string as byte object |
| 20 | if sys.version_info.major == 3: |
| 21 | a = bytes(a, encoding="utf-8") |
| 22 | |
| 23 | # set the correct data type and reshape the matrix into an image |
| 24 | a = base64_decode_array(a, dtype).reshape(shape) |
| 25 | |
| 26 | # return the loaded image |
| 27 | return a |
| 28 | |
| 29 | def base64_encode_array(a): |
| 30 | # return the base64 encoded array |
nothing calls this directly
no test coverage detected
searching dependent graphs…