cv
2014-05-18, 20:27:04
Ich wollte mal ein kleines Steganographie Programm schreiben. Ich musste jedoch feststellen, dass PIL unter Python 2.7.6 auch mit quality= 100 die Bitwerte einer .jpg verändert :mad:
Hier der Code
from PIL import Image
bild = raw_input("Bild? ")
img = Image.open(str(bild))
pixel = img.load()
def drucken():
for i in range(img.size[0]):
for j in range(img.size[1]):
print(pixel[i,j])
pixel[i,j] = (i,j,100)
img.save(str(bild),quality=100)
print(drucken(), img.mode)
Ausgegeben wird
(0, 0, 100)
(1, 1, 101)
(1, 4, 101)
(0, 3, 100)
(0, 5, 99)
(0, 5, 99)
(0, 6, 100)
(1, 7, 101)
(1, 8, 99)
(2, 9, 100)
(0, 10, 99)
(1, 11, 100)
(0, 11, 100)
(1, 12, 101)
(0, 15, 100)
(0, 15, 100)
(0, 17, 99)
(0, 17, 99)
(1, 19, 101)
(1, 19, 101)
(1, 1, 101)
(1, 1, 101)
(0, 2, 99)
(0, 3, 100)
(0, 5, 99)
(1, 6, 100)
(0, 6, 100)
(1, 7, 101)
(1, 8, 99)
(2, 9, 100)
(2, 12, 101)
(1, 11, 100)
(1, 12, 101)
(1, 12, 101)
(0, 15, 100)
(1, 16, 101)
(0, 17, 99)
(1, 18, 100)
(0, 18, 100)
(1, 19, 101)
(2, 0, 99)
(3, 1, 100)
(2, 2, 100)
(3, 3, 101)
(2, 5, 100)
(2, 5, 100)
(2, 7, 101)
(2, 7, 101)
(3, 8, 100)
(3, 8, 100)
(3, 10, 100)
(3, 10, 100)
(2, 12, 101)
(3, 13, 102)
(2, 14, 100)
(3, 15, 101)
(1, 16, 99)
(2, 17, 100)
(2, 19, 101)
(2, 19, 101)
(2, 0, 99)
(3, 1, 100)
(2, 2, 100)
(3, 3, 101)
(2, 5, 100)
(2, 5, 100)
(2, 7, 101)
(2, 7, 99)
(3, 8, 100)
(4, 9, 101)
(3, 10, 100)
(5, 12, 102)
(2, 12, 101)
(3, 13, 100)
(3, 15, 101)
(3, 15, 101)
(2, 17, 100)
(2, 17, 100)
(2, 19, 101)
(2, 19, 101)
(5, 0, 100)
(5, 0, 100)
(4, 2, 99)
(4, 2, 99)
(4, 4, 100)
(5, 5, 101)
(3, 6, 99)
(4, 7, 100)
(4, 7, 100)
(5, 9, 100)
(4, 9, 100)
(5, 10, 101)
(5, 12, 100)
(5, 12, 100)
(4, 14, 101)
(4, 14, 99)
(4, 16, 100)
(5, 17, 101)
(3, 18, 99)
(4, 19, 100)
(5, 0, 100)
(5, 0, 100)
(4, 2, 99)
(4, 2, 99)
(4, 4, 100)
(5, 5, 101)
(3, 6, 99)
(4, 7, 100)
(5, 9, 100)
(5, 9, 100)
(5, 10, 101)
(5, 10, 101)
(5, 12, 100)
(6, 13, 101)
(4, 14, 99)
(5, 15, 100)
(4, 16, 100)
(4, 16, 100)
(3, 18, 99)
(4, 19, 100)
(6, 0, 100)
(7, 1, 101)
(6, 2, 99)
(7, 3, 100)
(6, 5, 99)
(7, 6, 100)
(6, 7, 100)
(6, 7, 100)
(7, 8, 100)
(7, 8, 100)
(6, 10, 101)
(7, 11, 102)
(6, 12, 100)
(7, 13, 101)
(6, 14, 99)
(7, 15, 100)
(6, 16, 101)
(6, 16, 101)
(6, 18, 100)
(6, 18, 100)
(6, 0, 100)
(7, 1, 101)
(7, 3, 100)
(7, 3, 100)
(6, 5, 99)
(5, 4, 98)
(6, 7, 100)
(7, 8, 101)
(7, 8, 100)
(8, 9, 101)
(6, 10, 101)
(7, 11, 100)
(7, 13, 101)
(7, 13, 101)
(7, 15, 100)
(7, 15, 100)
(5, 15, 100)
(6, 16, 101)
(6, 18, 100)
(7, 19, 101)
(8, 0, 99)
(7, 0, 98)
(8, 2, 100)
(8, 2, 100)
(8, 4, 99)
(9, 5, 100)
(7, 6, 99)
(8, 7, 100)
(8, 7, 100)
(9, 8, 101)
(9, 10, 100)
(9, 10, 100)
(8, 12, 101)
(8, 12, 99)
(8, 14, 100)
(9, 15, 101)
(9, 17, 102)
(9, 17, 102)
(7, 18, 100)
(8, 19, 101)
(8, 0, 99)
(9, 1, 100)
(8, 2, 100)
(9, 3, 101)
(8, 4, 99)
(9, 5, 100)
(8, 7, 100)
(8, 7, 100)
(9, 8, 101)
(9, 8, 101)
(9, 10, 100)
(10, 11, 101)
(8, 12, 99)
(9, 13, 100)
(8, 14, 100)
(9, 15, 101)
(8, 16, 101)
(9, 17, 100)
(8, 19, 101)
(8, 19, 101)
(10, 0, 99)
(11, 1, 100)
(10, 3, 99)
(10, 3, 99)
(10, 4, 100)
(10, 4, 100)
(10, 6, 100)
(10, 6, 100)
(11, 7, 101)
(12, 8, 102)
(10, 10, 100)
(11, 11, 101)
(10, 12, 99)
(11, 13, 100)
(10, 14, 101)
(10, 14, 101)
(10, 16, 100)
(10, 16, 100)
(10, 18, 101)
(11, 19, 100)
(11, 1, 100)
(11, 1, 100)
(10, 3, 99)
(10, 3, 99)
(10, 4, 100)
(11, 5, 101)
(10, 6, 100)
(11, 7, 101)
(11, 7, 101)
(12, 9, 100)
(11, 11, 101)
(11, 11, 101)
(11, 13, 100)
(11, 13, 100)
(10, 14, 101)
(10, 15, 99)
(10, 16, 100)
(11, 17, 101)
(10, 18, 99)
(11, 19, 100)
(12, 0, 100)
(13, 1, 101)
(12, 2, 99)
(13, 3, 100)
(11, 4, 99)
(12, 5, 100)
(12, 7, 101)
(12, 7, 101)
(13, 8, 100)
(13, 8, 100)
(13, 10, 101)
(13, 10, 99)
(12, 12, 100)
(13, 13, 101)
(12, 14, 99)
(13, 15, 100)
(11, 16, 100)
(12, 17, 99)
(12, 19, 100)
(12, 19, 100)
(12, 0, 100)
(13, 1, 101)
(12, 2, 99)
(13, 3, 100)
(12, 5, 100)
(12, 5, 100)
(12, 7, 101)
(12, 7, 101)
(13, 8, 100)
(14, 9, 101)
(13, 10, 99)
(14, 11, 100)
(12, 12, 100)
(13, 13, 101)
(13, 15, 100)
(13, 15, 100)
(12, 17, 99)
(12, 17, 99)
(12, 19, 100)
(12, 19, 100)
(15, 1, 99)
(15, 1, 99)
(14, 2, 102)
(14, 2, 100)
(14, 4, 100)
(14, 4, 100)
(13, 6, 99)
(14, 7, 100)
(14, 7, 100)
(15, 8, 101)
(14, 9, 99)
(16, 11, 101)
(15, 12, 99)
(15, 12, 99)
(14, 14, 100)
(14, 14, 100)
(14, 16, 99)
(15, 17, 100)
(13, 18, 100)
(14, 19, 101)
(15, 1, 99)
(15, 1, 99)
(14, 2, 100)
(15, 3, 101)
(14, 4, 100)
(15, 5, 101)
(13, 6, 99)
(14, 7, 100)
(15, 8, 101)
(15, 8, 101)
(15, 10, 100)
(15, 10, 100)
(15, 12, 99)
(16, 13, 100)
(14, 14, 100)
(15, 15, 101)
(14, 16, 99)
(14, 16, 99)
(14, 19, 101)
(14, 19, 101)
(16, 0, 99)
(17, 1, 100)
(16, 2, 100)
(17, 3, 100)
(16, 5, 101)
(16, 5, 101)
(16, 7, 100)
(16, 7, 100)
(17, 8, 99)
(17, 8, 99)
(16, 10, 100)
(16, 11, 101)
(15, 12, 99)
(17, 14, 101)
(16, 14, 98)
(17, 15, 99)
(16, 17, 100)
(16, 17, 100)
(16, 19, 100)
(16, 19, 100)
(17, 1, 100)
(17, 1, 100)
(17, 3, 100)
(17, 3, 100)
(16, 5, 101)
(16, 5, 101)
(16, 7, 100)
(17, 8, 101)
(17, 8, 99)
(18, 9, 100)
(18, 9, 100)
(17, 11, 101)
(17, 13, 100)
(16, 13, 100)
(17, 15, 99)
(17, 15, 99)
(16, 17, 100)
(16, 17, 100)
(16, 19, 100)
(17, 20, 101)
(18, 0, 100)
(18, 0, 100)
(18, 2, 100)
(19, 3, 101)
(18, 4, 99)
(19, 5, 100)
(17, 6, 100)
(18, 7, 101)
(19, 8, 100)
(19, 8, 100)
(20, 10, 99)
(19, 10, 99)
(19, 13, 101)
(17, 13, 100)
(18, 14, 99)
(19, 15, 100)
(18, 16, 99)
(19, 17, 100)
(18, 19, 101)
(18, 19, 101)
(18, 0, 100)
(19, 1, 101)
(18, 2, 100)
(19, 3, 101)
(18, 4, 99)
(19, 5, 100)
(18, 7, 101)
(18, 7, 101)
(19, 8, 100)
(19, 8, 100)
(20, 10, 99)
(20, 11, 100)
(18, 12, 100)
(19, 13, 101)
(18, 14, 99)
(19, 15, 100)
(18, 16, 99)
(19, 17, 100)
(18, 19, 101)
(18, 19, 101)
(None, 'RGB')
Die Frage, die sich mir nun stellt, gibt es einen Weg die Kompression zu verhindern oder gibt es ein gebräuchliches Format, bei dem man die Kompression gänzlich abstellen kann?
Vielen Dank für Antworten
Hier der Code
from PIL import Image
bild = raw_input("Bild? ")
img = Image.open(str(bild))
pixel = img.load()
def drucken():
for i in range(img.size[0]):
for j in range(img.size[1]):
print(pixel[i,j])
pixel[i,j] = (i,j,100)
img.save(str(bild),quality=100)
print(drucken(), img.mode)
Ausgegeben wird
(0, 0, 100)
(1, 1, 101)
(1, 4, 101)
(0, 3, 100)
(0, 5, 99)
(0, 5, 99)
(0, 6, 100)
(1, 7, 101)
(1, 8, 99)
(2, 9, 100)
(0, 10, 99)
(1, 11, 100)
(0, 11, 100)
(1, 12, 101)
(0, 15, 100)
(0, 15, 100)
(0, 17, 99)
(0, 17, 99)
(1, 19, 101)
(1, 19, 101)
(1, 1, 101)
(1, 1, 101)
(0, 2, 99)
(0, 3, 100)
(0, 5, 99)
(1, 6, 100)
(0, 6, 100)
(1, 7, 101)
(1, 8, 99)
(2, 9, 100)
(2, 12, 101)
(1, 11, 100)
(1, 12, 101)
(1, 12, 101)
(0, 15, 100)
(1, 16, 101)
(0, 17, 99)
(1, 18, 100)
(0, 18, 100)
(1, 19, 101)
(2, 0, 99)
(3, 1, 100)
(2, 2, 100)
(3, 3, 101)
(2, 5, 100)
(2, 5, 100)
(2, 7, 101)
(2, 7, 101)
(3, 8, 100)
(3, 8, 100)
(3, 10, 100)
(3, 10, 100)
(2, 12, 101)
(3, 13, 102)
(2, 14, 100)
(3, 15, 101)
(1, 16, 99)
(2, 17, 100)
(2, 19, 101)
(2, 19, 101)
(2, 0, 99)
(3, 1, 100)
(2, 2, 100)
(3, 3, 101)
(2, 5, 100)
(2, 5, 100)
(2, 7, 101)
(2, 7, 99)
(3, 8, 100)
(4, 9, 101)
(3, 10, 100)
(5, 12, 102)
(2, 12, 101)
(3, 13, 100)
(3, 15, 101)
(3, 15, 101)
(2, 17, 100)
(2, 17, 100)
(2, 19, 101)
(2, 19, 101)
(5, 0, 100)
(5, 0, 100)
(4, 2, 99)
(4, 2, 99)
(4, 4, 100)
(5, 5, 101)
(3, 6, 99)
(4, 7, 100)
(4, 7, 100)
(5, 9, 100)
(4, 9, 100)
(5, 10, 101)
(5, 12, 100)
(5, 12, 100)
(4, 14, 101)
(4, 14, 99)
(4, 16, 100)
(5, 17, 101)
(3, 18, 99)
(4, 19, 100)
(5, 0, 100)
(5, 0, 100)
(4, 2, 99)
(4, 2, 99)
(4, 4, 100)
(5, 5, 101)
(3, 6, 99)
(4, 7, 100)
(5, 9, 100)
(5, 9, 100)
(5, 10, 101)
(5, 10, 101)
(5, 12, 100)
(6, 13, 101)
(4, 14, 99)
(5, 15, 100)
(4, 16, 100)
(4, 16, 100)
(3, 18, 99)
(4, 19, 100)
(6, 0, 100)
(7, 1, 101)
(6, 2, 99)
(7, 3, 100)
(6, 5, 99)
(7, 6, 100)
(6, 7, 100)
(6, 7, 100)
(7, 8, 100)
(7, 8, 100)
(6, 10, 101)
(7, 11, 102)
(6, 12, 100)
(7, 13, 101)
(6, 14, 99)
(7, 15, 100)
(6, 16, 101)
(6, 16, 101)
(6, 18, 100)
(6, 18, 100)
(6, 0, 100)
(7, 1, 101)
(7, 3, 100)
(7, 3, 100)
(6, 5, 99)
(5, 4, 98)
(6, 7, 100)
(7, 8, 101)
(7, 8, 100)
(8, 9, 101)
(6, 10, 101)
(7, 11, 100)
(7, 13, 101)
(7, 13, 101)
(7, 15, 100)
(7, 15, 100)
(5, 15, 100)
(6, 16, 101)
(6, 18, 100)
(7, 19, 101)
(8, 0, 99)
(7, 0, 98)
(8, 2, 100)
(8, 2, 100)
(8, 4, 99)
(9, 5, 100)
(7, 6, 99)
(8, 7, 100)
(8, 7, 100)
(9, 8, 101)
(9, 10, 100)
(9, 10, 100)
(8, 12, 101)
(8, 12, 99)
(8, 14, 100)
(9, 15, 101)
(9, 17, 102)
(9, 17, 102)
(7, 18, 100)
(8, 19, 101)
(8, 0, 99)
(9, 1, 100)
(8, 2, 100)
(9, 3, 101)
(8, 4, 99)
(9, 5, 100)
(8, 7, 100)
(8, 7, 100)
(9, 8, 101)
(9, 8, 101)
(9, 10, 100)
(10, 11, 101)
(8, 12, 99)
(9, 13, 100)
(8, 14, 100)
(9, 15, 101)
(8, 16, 101)
(9, 17, 100)
(8, 19, 101)
(8, 19, 101)
(10, 0, 99)
(11, 1, 100)
(10, 3, 99)
(10, 3, 99)
(10, 4, 100)
(10, 4, 100)
(10, 6, 100)
(10, 6, 100)
(11, 7, 101)
(12, 8, 102)
(10, 10, 100)
(11, 11, 101)
(10, 12, 99)
(11, 13, 100)
(10, 14, 101)
(10, 14, 101)
(10, 16, 100)
(10, 16, 100)
(10, 18, 101)
(11, 19, 100)
(11, 1, 100)
(11, 1, 100)
(10, 3, 99)
(10, 3, 99)
(10, 4, 100)
(11, 5, 101)
(10, 6, 100)
(11, 7, 101)
(11, 7, 101)
(12, 9, 100)
(11, 11, 101)
(11, 11, 101)
(11, 13, 100)
(11, 13, 100)
(10, 14, 101)
(10, 15, 99)
(10, 16, 100)
(11, 17, 101)
(10, 18, 99)
(11, 19, 100)
(12, 0, 100)
(13, 1, 101)
(12, 2, 99)
(13, 3, 100)
(11, 4, 99)
(12, 5, 100)
(12, 7, 101)
(12, 7, 101)
(13, 8, 100)
(13, 8, 100)
(13, 10, 101)
(13, 10, 99)
(12, 12, 100)
(13, 13, 101)
(12, 14, 99)
(13, 15, 100)
(11, 16, 100)
(12, 17, 99)
(12, 19, 100)
(12, 19, 100)
(12, 0, 100)
(13, 1, 101)
(12, 2, 99)
(13, 3, 100)
(12, 5, 100)
(12, 5, 100)
(12, 7, 101)
(12, 7, 101)
(13, 8, 100)
(14, 9, 101)
(13, 10, 99)
(14, 11, 100)
(12, 12, 100)
(13, 13, 101)
(13, 15, 100)
(13, 15, 100)
(12, 17, 99)
(12, 17, 99)
(12, 19, 100)
(12, 19, 100)
(15, 1, 99)
(15, 1, 99)
(14, 2, 102)
(14, 2, 100)
(14, 4, 100)
(14, 4, 100)
(13, 6, 99)
(14, 7, 100)
(14, 7, 100)
(15, 8, 101)
(14, 9, 99)
(16, 11, 101)
(15, 12, 99)
(15, 12, 99)
(14, 14, 100)
(14, 14, 100)
(14, 16, 99)
(15, 17, 100)
(13, 18, 100)
(14, 19, 101)
(15, 1, 99)
(15, 1, 99)
(14, 2, 100)
(15, 3, 101)
(14, 4, 100)
(15, 5, 101)
(13, 6, 99)
(14, 7, 100)
(15, 8, 101)
(15, 8, 101)
(15, 10, 100)
(15, 10, 100)
(15, 12, 99)
(16, 13, 100)
(14, 14, 100)
(15, 15, 101)
(14, 16, 99)
(14, 16, 99)
(14, 19, 101)
(14, 19, 101)
(16, 0, 99)
(17, 1, 100)
(16, 2, 100)
(17, 3, 100)
(16, 5, 101)
(16, 5, 101)
(16, 7, 100)
(16, 7, 100)
(17, 8, 99)
(17, 8, 99)
(16, 10, 100)
(16, 11, 101)
(15, 12, 99)
(17, 14, 101)
(16, 14, 98)
(17, 15, 99)
(16, 17, 100)
(16, 17, 100)
(16, 19, 100)
(16, 19, 100)
(17, 1, 100)
(17, 1, 100)
(17, 3, 100)
(17, 3, 100)
(16, 5, 101)
(16, 5, 101)
(16, 7, 100)
(17, 8, 101)
(17, 8, 99)
(18, 9, 100)
(18, 9, 100)
(17, 11, 101)
(17, 13, 100)
(16, 13, 100)
(17, 15, 99)
(17, 15, 99)
(16, 17, 100)
(16, 17, 100)
(16, 19, 100)
(17, 20, 101)
(18, 0, 100)
(18, 0, 100)
(18, 2, 100)
(19, 3, 101)
(18, 4, 99)
(19, 5, 100)
(17, 6, 100)
(18, 7, 101)
(19, 8, 100)
(19, 8, 100)
(20, 10, 99)
(19, 10, 99)
(19, 13, 101)
(17, 13, 100)
(18, 14, 99)
(19, 15, 100)
(18, 16, 99)
(19, 17, 100)
(18, 19, 101)
(18, 19, 101)
(18, 0, 100)
(19, 1, 101)
(18, 2, 100)
(19, 3, 101)
(18, 4, 99)
(19, 5, 100)
(18, 7, 101)
(18, 7, 101)
(19, 8, 100)
(19, 8, 100)
(20, 10, 99)
(20, 11, 100)
(18, 12, 100)
(19, 13, 101)
(18, 14, 99)
(19, 15, 100)
(18, 16, 99)
(19, 17, 100)
(18, 19, 101)
(18, 19, 101)
(None, 'RGB')
Die Frage, die sich mir nun stellt, gibt es einen Weg die Kompression zu verhindern oder gibt es ein gebräuchliches Format, bei dem man die Kompression gänzlich abstellen kann?
Vielen Dank für Antworten