python图片二进制流转换成图片_python将图片二进制数据转换成Django file对象
來自django.core.file的二進制數(shù)據(jù),來自于來自django.core.file的二進制數(shù)據(jù),來自于前端攝像頭uwsgi套接字的djanyUploadedFilefrom io IMPORT BytesIOf=BytesIO()#Image,data=b‘\xff\xd8\xff\xe0\x00\x10JFIF\x00\x0的二進制數(shù)據(jù)。省略9\xff\xd9‘.Well(Data)#InMemyUploadedFileRequired參數(shù):file、field_name、Content_type、size、Charset、Content_type_EXPLUTER=NoneImage=InMemyUploadedFile(f、None、’aa‘、None、len(Data)、None、None)。
#現(xiàn)在,Image是Django的file對象。
在[11]:ImageOut[11]:in[12]:type(Image)out[12]:django.core.files.uploadedfile.InMemoryUploadedFile.。
確定二進制數(shù)據(jù)是否為圖像。
導(dǎo)入imghdrs=imghdr.thing(無,數(shù)據(jù))。
如果不是圖片,則不返回任何-圖片返回的圖片類型的字符串
總結(jié)
以上是生活随笔為你收集整理的python图片二进制流转换成图片_python将图片二进制数据转换成Django file对象的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 跨行通存通兑是什么意思
- 下一篇: html请求接口_python接口自动化