Python 3 Script to Overlay or Blend or Merge Transparent Logo Image with Another PNG Image Using Pillow Module Full Project For Beginners


Welcome folks today in this blog post we will be merging or overlaying or blending transparent logo image with another png image using pillow module in python 3.All the full source code of the application is shown below.




Get Started




In order to get started you need to make an file and copy paste the following code



# import PIL module
from PIL import Image

# Front Image
filename = 'front.png'

# Back Image
filename1 = 'back.jpg'

# Open Front Image
frontImage =

# Open Background Image
background =

# Convert image to RGBA
frontImage = frontImage.convert("RGBA")

# Convert image to RGBA
background = background.convert("RGBA")

# Calculate width to be at the center
width = (background.width - frontImage.width) // 2

# Calculate height to be at the center
height = (background.height - frontImage.height) // 2

# Paste the frontImage at (width, height)
background.paste(frontImage, (width, height), frontImage)

# Save this image"new.png", format="png")

Leave a Reply