Skip to content

Blog

Use Python PIL module to merge two images


Introduction

Recently, because I have been studying the interface of the program, I got many strange problems.

I want to record today is how to merge two pictures. I found that if I simply use the composite() function in PIL, the second picture will be overwritten by the first picture. So, I started to try convert the background of the second picture to transparent.

After converting the image to a transparent background, the result of the merging is quite natural to me.

I will start to introduce how to merge two pictures in below.

Read More »Use Python PIL module to merge two images

[Solved][Python] AttributeError: module ‘win32ctypes.pywin32.win32api’ has no attribute ‘error’

python
Display Python code on the screen

Introduction

Today I used PyInstaller to package my Python program to execute file on Windows, I got an error message:

AttributeError: module 'win32ctypes.pywin32.win32api' has no attribute 'error'

After I searching some information on Internet, I found it is a common problem about icon picture of our GUI program. The icon need to use the .ico file, but I use a .png file.

This icon is on the computer desktop dock, not the icon on the program window.

Read More »[Solved][Python] AttributeError: module ‘win32ctypes.pywin32.win32api’ has no attribute ‘error’

[PyQt5] Use icon from QStyle

PyQt5

Introduction

When we using PyQt5 framework to develop a GUI program, we usually need some icon to display our buttons or components. Many times we can load pictures from outside, but if we need common icons, such as play icon, close icon, minimum icon … etc, we can use the built-in icon picture from QStyle module.

This has another advantage: we don’t have to worry about pictures when packing the GUI program.

Below I will introduce how to use the icons in QStyle.

Read More »[PyQt5] Use icon from QStyle

How to use Pickle module to store data in Python

Python is the most popular programming language!

Introduction

Hello! Today I want to record the “pickle” module in Python. The “pickle” module is very famous module in Python, its usage is like another Python package “Json”, it can compress the data and store it. If we want to load the data we store, we can easily call the “load()” function to restore our session.

Read More »How to use Pickle module to store data in Python

Using Python package “ujson” to increase Json processing speed

Python is the most popular programming language!

Introduction

Whatever programming language we used, we always selected Json format to store our data.

Json (JavaScript Object Notation) is a lightweight data-interchange format, and it is readable and suitable for storing data. But in Python, sometimes we have performance bottlenecks in reading Json files, especially when the files are too large.

Read More »Using Python package “ujson” to increase Json processing speed