Full code: https://paste.pythondiscord.com/kenatayuce.py
I am encountering this error when trying to use LSB Steganography on a GIF:
pix = [value for value in imdata.next()[:3] + # 3 pixels extracted at one time
TypeError: 'int' object is not subscriptable
def modPix(pix, data): # Pixels are modified from 8-bit binary
Link to full code: https://paste.pythondiscord.com/kenatayuce.py
datalist = genData(data)
lendata = len(datalist)
imdata = iter(pix)
for i in range(lendata):
pix = [value for value in imdata.__next__()[:3] + # 3 pixels extracted at one time
imdata.__next__()[:3] +
imdata.__next__()[:3]]
for j in range(0, 8):
if (datalist[i][j] == '0' and pix[j]% 2 != 0): # Pixel value = 1 for odd, 0 for even
pix[j] -= 1
elif (datalist[i][j] == '1' and pix[j] % 2 == 0):
if(pix[j] != 0):
pix[j] -= 1
else:
pix[j] += 1
if (i == lendata - 1): # 8th pixel will state whether to stop or to carry on reading
if (pix[-1] % 2 == 0): # 0 = Keep reading.
if(pix[-1] != 0): # 1 = Stop. Message is over.
pix[-1] -= 1
else:
pix[-1] += 1
else:
if (pix[-1] % 2 != 0):
pix[-1] -= 1
pix = tuple(pix)
yield pix[0:3]
yield pix[3:6]
yield pix[6:9]