NEW: writes two jpg files with -w option (no picseal data yet)
This commit is contained in:
parent
3da723c89d
commit
b2dad578a0
|
@ -144,6 +144,7 @@ class JpgBin:
|
|||
def markerAppData(self, marker_hex):
|
||||
self.__addPrevMarkerData(marker_hex, "APP ", False)
|
||||
rec_len = self.__calcSeekBytes()
|
||||
logging.info("length=={}".format(str(rec_len)))
|
||||
|
||||
#
|
||||
def markerComment(self, marker_hex):
|
||||
|
@ -156,19 +157,23 @@ class JpgBin:
|
|||
#
|
||||
def markerSOS(self, marker_hex):
|
||||
self.__addPrevMarkerData(marker_hex, "SOS ")
|
||||
self.data_idx += 2
|
||||
|
||||
|
||||
#
|
||||
def markerRST(self, marker_hex):
|
||||
self.__addPrevMarkerData(marker_hex, "RST ")
|
||||
self.data_idx += 2
|
||||
|
||||
#
|
||||
def markerDQT(self, marker_hex):
|
||||
rec_len = self.__calcSeekBytes()
|
||||
self.__addPrevMarkerData(marker_hex, "DQT ")
|
||||
rec_len = self.__calcSeekBytes()
|
||||
|
||||
#
|
||||
def markerDRI(self, marker_hex):
|
||||
self.__addPrevMarkerData(marker_hex, "DRI ")
|
||||
self.data_idx += 4
|
||||
|
||||
#
|
||||
def markerSOF0(self, marker_hex):
|
||||
|
@ -188,6 +193,7 @@ class JpgBin:
|
|||
def markerEOI(self, marker_hex):
|
||||
self.__addPrevMarkerData(marker_hex, "EOI ")
|
||||
self.__addPrevMarkerData(marker_hex, "JUST A DUMMY VALUE")
|
||||
self.data_idx += 2
|
||||
|
||||
|
||||
# private helper function
|
||||
|
@ -204,7 +210,6 @@ class JpgBin:
|
|||
self.prev_mhex = mhex
|
||||
self.prev_mstr = mstr
|
||||
self.prev_fpos = cur_fpos
|
||||
self.data_idx += 2
|
||||
self.prev_imgData = imgData
|
||||
|
||||
#
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
#
|
||||
class JpgBinWrite:
|
||||
|
||||
soi_marker = 0xffd8
|
||||
eof_marker = 0xffd9
|
||||
picseal_marker = 0xffe0
|
||||
soi_marker = b'\xff\xd8'
|
||||
eof_marker = b'\xff\xd9'
|
||||
picseal_marker = b'\xff\xe0'
|
||||
|
||||
#
|
||||
def __init__(self, jpg_in, jpg_out):
|
||||
|
@ -49,6 +49,7 @@ class JpgBinWrite:
|
|||
self.fhr.seek(marker.fpos)
|
||||
data = self.fhr.read(marker.len)
|
||||
self.fhw.write(data)
|
||||
self.fhw.flush()
|
||||
|
||||
#
|
||||
# array of the marker information
|
||||
|
@ -62,6 +63,7 @@ class JpgBinWrite:
|
|||
|
||||
data = self.fhr.read(marker.len)
|
||||
self.fhw.write(data)
|
||||
self.fhw.flush()
|
||||
|
||||
#
|
||||
def __writeJpgHeader(self):
|
||||
|
|
10
picseal.py
10
picseal.py
|
@ -20,14 +20,14 @@ def main():
|
|||
# create new pub keys, sign hash
|
||||
# export signature & public key to a new image file
|
||||
def processImage(image_fn):
|
||||
jpg = JpgProc()
|
||||
jpg.process(image_fn)
|
||||
jpg.hash()
|
||||
jpg_proc = JpgProc()
|
||||
jpg_proc.process(image_fn)
|
||||
jpg_proc.hash()
|
||||
if (write_picseal):
|
||||
print("Writing PicSeal JPG files...")
|
||||
jpg.writePicSealJpg()
|
||||
jpg_proc.writePicSealJpg()
|
||||
|
||||
printImageInfo(jpg)
|
||||
printImageInfo(jpg_proc.jpg)
|
||||
|
||||
#
|
||||
def printImageInfo(jpg_bin):
|
||||
|
|
Loading…
Reference in New Issue