If you are interested in watermarking images, you can take a look at steganography . As an example, Digital_Sight is a working demonstration of the concept and can be used as the basis for storing text used as a watermark. To learn how changing different pixel bits in an image can change its quality, you can play with Color_Disruptor before deciding which data to overwrite.
Digital_sight
import cStringIO from PIL import Image import bz2 import math
Color_disruptor
from cStringIO import StringIO from PIL import Image from random import randrange def main(data, r_bits, g_bits, b_bits, a_bits): image = Image.open(data) if image.mode != 'RGBA': image = image.convert('RGBA') width, height = image.size array = image.load() data.close() for x in range(width): for y in range(height): r, g, b, a = array[x, y] r ^= randrange(r_bits) g ^= randrange(g_bits) b ^= randrange(b_bits) a ^= randrange(a_bits) array[x, y] = r, g, b, a data = StringIO() image.save(data, 'PNG') print 'Content-Type: image/PNG' print data.getvalue() if __name__ == '__builtin__': main(StringIO(DATA), *map(lambda bits: 1 << int(bits), (R, G, B, A)))
source share