![]() Image.open(result_file).save(result_file + '. Now open it with PIL and save it in the format you actually want (PIL doesn't care about the format of the input image and about 80 different ones are supported). Os.rename(result_file, result_file + '.tiff')Īgain just take the binary data as it is and write it to a file (in binary mode). Os.rename(result_file, result_file + '.bmp') Os.rename(result_file, result_file + '.gif') ![]() Os.rename(result_file, result_file + '.png') Os.rename(result_file, result_file + '.jpg') Write support is less extensive, but most common interchange and presentation formats are supported. Over 30 different file formats can be identified and read by the library. With open(result_file, 'wb') as file_handler: The Python Imaging Library supports a wide variety of raster file formats. Then use magic (a libmagic wrapper) to determine the mime type. Just take the binary data as it is and write it to a file (in binary mode). Really looks like the API doesn't populate this info. What type of data is this- (Base 64 encoded PNG? How do I tell?)īut more importantly - What do I do with this? How do I save this as an image, or display it as an image with HTML? The documentation says it'll return "The binary image data" in a string. I'm working with Musicbrainsngs - the Python lib for Musicbrainz API.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |