【发布时间】:2017-04-24 10:12:00
【问题描述】:
我需要读入来自用户的消息,遍历消息的每个位,并用每个消息位覆盖最低有效图像位。
我目前有一个程序可以遍历每个图像像素并重写图像。
那么我如何读取最低有效位以及如何获取每个消息位。
这是使用 python 3.x 的灰度图像
from PIL import Image
import numpy as np
import bitget
import scipy.misc as smp
im = Image.open("catBlack.png") #Can be many different formats.
pix = im.load()
print (im.size )#Get the width and hight of the image for iterating over
print (pix[1,1]) #Get the RGBA Value of the a pixel of an image
#pix[x,y] = value # Set the RGBA Value of the image (tup
data = np.zeros( (im.size[0],im.size[1],2), dtype=np.uint8 )
for i in range (im.size[0]):
for j in range (im.size[1]):
print (i,j)
data[i,j] = pix[i,j]
im = Image.fromarray(data)
im.save("GreyCat.png")
另外,我将如何解码出这条消息
为帮助干杯
【问题讨论】:
-
我对整个话题提出了质疑,因为我不知道从哪里开始?怎么办?我该如何更换。是不是让像素将其转换为位,然后将 asci 位值放在图像像素的 lsb 的位置。每个字符串字符是否占用多个位。我如何表示文本的结尾和文本的开头
-
你可能想考虑现有的steganography_tools
标签: python image python-imaging-library steganography