当前位置:网站首页>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)
边栏推荐
- When Valentine's Day falls on Monday
- Get weekday / day of week for datetime column of dataframe - get weekday / day of week for datetime column of dataframe
- MySQL inserts Chinese data and reports an error. Set the default collation
- Cloud computing technology [2]
- Record the problems encountered by nodejs asynchronism
- Don't you want to have a face-to-face communication with cloud native and open source experts? (including benefits
- 股票开户要找谁?手机开户是安全么?
- Who do you want to open a stock account? Is it safe to open a mobile account?
- Gbase 8s database basic syntax
- ctf-HCTF-Final-Misc200
猜你喜欢

D4: unpaired image defogging, self enhancement method based on density and depth decomposition (CVPR 2022)

PIP version update timeout - download using domestic image

如何防止你的 jar 被反编译?

qwb2018_ core kernel_ rop

Volvo's first MPV is exposed! Comfortable and safe, equipped with 2.0T plug-in mixing system, it is worth first-class
![[shutter] shutter layout component (physicalmodel component)](/img/6a/f8161fb7c8e9012456622f1920da64.gif)
[shutter] shutter layout component (physicalmodel component)

D4:非成对图像去雾,基于密度与深度分解的自增强方法(CVPR 2022)

基本IO接口技术——微机第七章笔记

Read a doctor, the kind that studies cows! Dr. enrollment of livestock technology group of Leuven University, milk quality monitoring
![[hands on deep learning]02 softmax regression](/img/47/eb67ec2c51f6bb7d6b2879b36e769d.jpg)
[hands on deep learning]02 softmax regression
随机推荐
Research Report on crude oil tanker industry - market status analysis and development prospect forecast
Research Report on micro gripper industry - market status analysis and development prospect prediction
6 pyspark Library
Write the content into the picture with type or echo and view it with WinHex
Centos7 installation and configuration of redis database
rwctf2022_ QLaaS
When Valentine's Day falls on Monday
[shutter] statefulwidget component (floatingactionbutton component | refreshindicator component)
China microporous membrane filtration market trend report, technological innovation and market forecast
Structured text language XML
发现你看不到的物体!南开&武大&ETH提出用于伪装目标检测SINet,代码已开源!...
Unexpectedly, there are such sand sculpture code comments! I laughed
Construction and maintenance of business websites [9]
One week dynamics of dragon lizard community | 2.07-2.13
China's crude oil heater market trend report, technological innovation and market forecast
Analysis of enterprise financial statements [1]
MySQL installation failed -gpg verification failed
China Indonesia advanced wound care market trend report, technological innovation and market forecast
[question brushing diary] classic questions of dynamic planning
MySQL learning record (5)