Use of transparent channels
Putalpha (Alpha)
This method is a magical way, you can write a picture (and the original size of the same) to the original image of the transparent channel, without affecting the normal display of the original picture, can be used for information hiding oh. Of course, the premise is that the original
The initial picture has a transparent channel. However, even if it is not much of a relationship, because there is the CONVERT function provided by PIL, you can convert a picture into RGBA mode, and then turn the information file to be hidden to "L" or "1" mode
Use this putalpha to overlay it. And in the image of the user, just need to simply extract the transparent channel can be seen hidden information, haha.
Python code
def hideinfoinimage (IMG, info):
if img.mode! = "RGBA":
img = Img.convert ("RGBA")
if info.mode! = "L" and Info.mode! = "1":
info = Info.convert ("L")
Img.putalpha (Info)
return img
Introduction to the PY image module