当前位置:网站首页>Chargement de l'image pyqt après décodage et codage de l'image
Chargement de l'image pyqt après décodage et codage de l'image
2022-07-02 21:39:00 【Wei Wei.】
Écrivez le titre du catalogue ici
Décodage d'imagebase64
Passe d'abord l'image parbase64,Décoder en octets;
def pictopy(picture_names, py_name):
""" Convertir le fichier image enpyDocumentation :param picture_name: """
write_data = []
for picture_name in picture_names:
filename = picture_name.replace('.', '_')
open_pic = open("%s" % picture_name, 'rb')
b64str = base64.b64encode(open_pic.read())
open_pic.close()
# Par ici.b64strAssurez - vous d'ajouter.decode()
write_data.append('%s = "%s"\n' % (filename, b64str.decode()))
#Enregistrer les octets d'image décodés dans .pyDocumentation
f = open('%s.py' % py_name, 'w+')
for data in write_data:
f.write(data)
f.close()
Codage
Bytecode pass base64Codage,
def get_pic(pic_code, pic_name):
image = open(pic_name, 'wb')
image.write(base64.b64decode(pic_code))
image.close()
label Charger l'image
def get_pic_decode(self, pic_code):
img_b64decode = base64.b64decode(pic_code)
img_io = io.BytesIO(img_b64decode)
img = Image.open(img_io)
pix = img.toqpixmap()
self.gif_label.setPixmap(pix)
self.gif_label.setScaledContents(True)
Exemple
if __name__ == '__main__':
pics = ["qq.gif", "Assieds - toi..gif", "Asseyez - vous.gif", "Marcher.gif"]
pictopy(pics, 'memory_pic') # Oui.pics L'image à l'intérieur dit memory_pic.py Moyenne
print("ok")
get_pic_decode(qq_gif)
边栏推荐
- 基本IO接口技术——微机第七章笔记
- Go web programming practice (1) -- basic syntax of go language
- [shutter] statefulwidget component (create statefulwidget component | materialapp component | scaffold component)
- MySQL learning record (7)
- Basic IO interface technology - microcomputer Chapter 7 Notes
- Internet Explorer ignores cookies on some domains (cannot read or set cookies)
- Construction and maintenance of business websites [8]
- ctf-HCTF-Final-Misc200
- [shutter] shutter layout component (physicalmodel component)
- Research Report on market supply and demand and strategy of Chinese garden equipment industry
猜你喜欢
rwctf2022_ QLaaS
Investment strategy analysis of China's electronic information manufacturing industry and forecast report on the demand outlook of the 14th five year plan 2022-2028 Edition
6 pyspark Library
Share the easy-to-use fastadmin open source system - Installation
D4: unpaired image defogging, self enhancement method based on density and depth decomposition (CVPR 2022)
Cardinality sorting (detailed illustration)
MySQL learning record (4)
The web version of xshell supports FTP connection and SFTP connection [detailed tutorial] continued from the previous article
[shutter] statefulwidget component (create statefulwidget component | materialapp component | scaffold component)
How does esrally perform simple custom performance tests?
随机推荐
China's noise meter market trend report, technical dynamic innovation and market forecast
Research Report on market supply and demand and strategy of Chinese garden equipment industry
Accounting regulations and professional ethics [16]
Sweet talk generator, regular greeting email machine... Open source programmers pay too much for this Valentine's day
Today, I met a Alipay and took out 35K. It's really sandpaper to wipe my ass. it's a show for me
3DES (deSede) encryption CBC mode pkcs7padding filling Base64 encoding key 24byte iv8byte
Redis -- three special data types
5 environment construction spark on yarn
Go language learning summary (5) -- Summary of go learning notes
Accounting regulations and professional ethics [17]
Market trend report, technical innovation and market forecast of China's Micro pliers
Detailed explanation of OSI seven layer model
MySQL installation failed -gpg verification failed
Sword finger offer (I) -- handwriting singleton mode
7. Build native development environment
treevalue——Master Nested Data Like Tensor
Investment strategy analysis of China's electronic information manufacturing industry and forecast report on the demand outlook of the 14th five year plan 2022-2028 Edition
Send blessings on Lantern Festival | limited edition red envelope cover of audio and video is released!
[shutter] statefulwidget component (create statefulwidget component | materialapp component | scaffold component)
China plastic bottle and container market trend report, technological innovation and market forecast