I have the following program:
import fileinput
import base64
for index, line in enumerate(fileinput.input('input1.txt'), 1):
if line.startswith('data:image/jpeg;base64,'):
with open('image{0:04}.jpeg'.format(index), 'wb') as jpeg:
line = line.strip()
jpeg.write(base64.b64decode(line[22:] + '===='))
Intent is to pick base64 data from a file and create jpeg files from it. But somehow it is not identifying the starting characters as jpeg (have tried using jpg) and is skipping the data.