[ Log On ]
  • Home
  • Tst
  • Cha
  • Enc
  • Code
  • IP
  • Fun
  • Sub
  • DigF
  • Cis
  • Com
  • Db
  • About
  • Netsim

JPEG Tag processor

 

[Back] JPEG files contain various tags, such as "FF F8" for the start of the file. This page analyses some of these tags.

Some faces

Select a face:

[Steve Jobs:] [David Cameron:] [Obama: ]
[Nixon: ] [Clint Eastwood: ] [Nicola Sturgeon: ]
[Cat: ] [Lincoln: ] [John travolta: ]
[Jackie Brambles: ]

Pixel block


Forensic analysis: [here]

Debug

Outline code

import binascii

file='111.jpg'

if (len(sys.argv)>1):
        file=str(sys.argv[1])


with open(file, 'rb') as f:
	print "First 64 bytes:"
	byte_s = f.read(16)
	hex_byte = binascii.hexlify(byte_s)
	print hex_byte
	byte_s = f.read(16)
	hex_byte = binascii.hexlify(byte_s)
	print hex_byte
	byte_s = f.read(16)
	hex_byte = binascii.hexlify(byte_s)
	print hex_byte
	byte_s = f.read(16)
	hex_byte = binascii.hexlify(byte_s)
	print hex_byte
	f.close()

print ""
with open(file, 'rb') as f:
	byte_s = f.read(1)	
	hex_byte = binascii.hexlify(byte_s)
	while byte_s:
		if (hex_byte=="ff"): 
			byte_s = f.read(1)
			hex_byte = binascii.hexlify(byte_s)
			if (hex_byte=="d8"): print ("FFF8: Start of file")
			if (hex_byte=="db"): print ("FFDB: Quantization Table")
			if (hex_byte=="c4"): print ("FFC4: Huffman Table")
			if (hex_byte=="c0"): print ("FFC0: Start Of Frame (Baseline DCT)")
			if (hex_byte=="da"): print ("FFDA: Start Of Scan")
			if (hex_byte=="00"): print ("FF00: Stuffed FF (Likely Huffman Coding)")

		else:
			byte_s = f.read(1)
			hex_byte = binascii.hexlify(byte_s)
	f.close()