0

I am trying to blend an image into another with python to set as your wallpaper for every frame of the fading animation.

I've look on several fourms and haven't found anyone trying to do the same thing and I have never messed with photo editing in python just game stuff and what im doing is completely different.

Turnrp
  • 5
  • 1
  • This is multiple questions in one so that's why you've not found the exact same thing, break down your problem and you will find people who have done each step. – Peter Feb 05 '23 at 23:21

1 Answers1

0

I have two png pictures a smily and a green triangle. Than you can do e.g. with openCV something like:

import cv2
import numpy as np 

image1 = cv2.imread('Face1.png') 
image2 = cv2.imread('Nose1.png')

print(f"Size image 1 and image 2 is {image1.shape} and {image2.shape}")
image2_resized = cv2.resize(image2, (image1.shape[1],image1.shape[0])) 
print(f"After reshape image 1 and image 2 (after resizing) is {image1.shape} and {image2_resized.shape}")

blended_image = cv2.addWeighted(src1=image1,alpha=0.5,src2=image2_resized,beta=0.5,gamma=0)

#cv2.imshow('Im1',image2) 
#cv2.imshow('Im2',image2)
cv2.imshow('Blended',blended_image) 

cv2.waitKey(0)

Output:

enter image description here

Hermann12
  • 1,709
  • 2
  • 5
  • 14