I do not know about this particular filter, but I can tell you how to follow Coincoin's PIL steps . I really did not run the code, but you can use it as a link:
Download both source and destination JPEG
from PIL import Image
img1 = Image.open('image1.jpg')
img2 = Image.open('image2.jpg')
Convert pixels from an RGB color space to a Lab color space (or any other color space with luminosirty information)
colorMatrix = (
x1, y1, z1, 0,
x2, y2, z2, 0,
x3, y3, z3, 0
)
img1 = img1.convert("RGB", colorMatrix)
img2 = img2.convert("RGB", colorMatrix)
Save target color channels and replace its brightness channel by source brightness
l1, a1, b1 = img1.split()
l2, a2, b2 = img2.split()
img1.putdata(zip(l1.getdata(), a2.getdata(), b2.getdata()))
Convert back to RGB space
RGBcolorMatrix = (
x1, y1, z1, 0,
x2, y2, z2, 0,
x3, y3, z3, 0
)
img1 = img1.convert("RGB", RGBcolorMatrix)
Save JPEG
img1.save('new_image.jpg')