当前位置:网站首页>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)
边栏推荐
- Codeworks global round 19 (CF 1637) a ~ e problem solution
- Don't you want to have a face-to-face communication with cloud native and open source experts? (including benefits
- Basic knowledge of tree and binary tree (detailed illustration)
- Research Report on market supply and demand and strategy of China's right-hand outward rotation entry door industry
- The web version of xshell supports FTP connection and SFTP connection [detailed tutorial] continued from the previous article
- Analysis of enterprise financial statements [2]
- MySQL learning notes (Advanced)
- ctf-HCTF-Final-Misc200
- Construction and maintenance of business websites [4]
- rwctf2022_ QLaaS
猜你喜欢

How does esrally perform simple custom performance tests?

MySQL learning record (5)

qwb2018_ core kernel_ rop
![[use of pointer and pointer and array]](/img/dd/8017215c54aebcdf5c67e46e795d3b.jpg)
[use of pointer and pointer and array]

26 FPS video super-resolution model DAP! Output 720p Video Online
![[shutter] statefulwidget component (create statefulwidget component | materialapp component | scaffold component)](/img/04/4070d51ce8b7718db609ef2fc8bcd7.jpg)
[shutter] statefulwidget component (create statefulwidget component | materialapp component | scaffold component)

MySQL learning record (3)
![[error record] the command line creates an error pub get failed (server unavailable) -- attempting retry 1 in 1 second](/img/6e/c82ff02a249b5d275a4589120a197a.jpg)
[error record] the command line creates an error pub get failed (server unavailable) -- attempting retry 1 in 1 second

读博士吧,研究奶牛的那种!鲁汶大学 Livestock Technology 组博士招生,牛奶质量监测...

D4: unpaired image defogging, self enhancement method based on density and depth decomposition (CVPR 2022)
随机推荐
Cardinality sorting (detailed illustration)
System (hierarchical) clustering method and SPSS implementation
Analysis of enterprise financial statements [2]
China microporous membrane filtration market trend report, technological innovation and market forecast
[CV] Wu Enda machine learning course notes | Chapter 12
How is LinkedList added?
Construction and maintenance of business website [2]
Accounting regulations and professional ethics [18]
发现你看不到的物体!南开&武大&ETH提出用于伪装目标检测SINet,代码已开源!...
Adding data to the head or tail of the rar file can still decompress normally
Basic knowledge of tree and binary tree (detailed illustration)
D4: unpaired image defogging, self enhancement method based on density and depth decomposition (CVPR 2022)
6 pyspark Library
D4:非成对图像去雾,基于密度与深度分解的自增强方法(CVPR 2022)
Construction and maintenance of business website [1]
7. Build native development environment
Research Report on plastic antioxidant industry - market status analysis and development prospect forecast
MySQL learning record (7)
treevalue——Master Nested Data Like Tensor
China Indonesia advanced wound care market trend report, technological innovation and market forecast