Introduction to the PY image module

Source: Internet
Author: User

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

  1. def hideinfoinimage (IMG, info):

  2. if img.mode! = "RGBA":

  3. img = Img.convert ("RGBA")

  4. if info.mode! = "L" and Info.mode! = "1":

  5. info = Info.convert ("L")

  6. Img.putalpha (Info)

  7. return img


Introduction to the PY image module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.