forked from josch/img2pdf
Make pep8 compliant again
This commit is contained in:
parent
c2f43a579e
commit
962d4dbdfb
3 changed files with 8 additions and 3 deletions
|
@ -167,6 +167,8 @@ class MyPdfDict(object):
|
||||||
class MyPdfName():
|
class MyPdfName():
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
return b'/' + name.encode('ascii')
|
return b'/' + name.encode('ascii')
|
||||||
|
|
||||||
|
|
||||||
MyPdfName = MyPdfName()
|
MyPdfName = MyPdfName()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1709,5 +1711,6 @@ values set via the --border option.
|
||||||
traceback.print_exc(file=sys.stderr)
|
traceback.print_exc(file=sys.stderr)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -116,6 +116,7 @@ def parsejp2(data):
|
||||||
# retrieving the dpi is optional so we do not error out if not present
|
# retrieving the dpi is optional so we do not error out if not present
|
||||||
return (width, height, colorspace, hdpi, vdpi)
|
return (width, height, colorspace, hdpi, vdpi)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
width, height, colorspace = parsejp2(open(sys.argv[1]).read())
|
width, height, colorspace = parsejp2(open(sys.argv[1]).read())
|
||||||
|
|
|
@ -400,7 +400,7 @@ layout_test_cases = [
|
||||||
|
|
||||||
def tiff_header_for_ccitt(width, height, img_size, ccitt_group=4):
|
def tiff_header_for_ccitt(width, height, img_size, ccitt_group=4):
|
||||||
# Quick and dirty TIFF header builder from
|
# Quick and dirty TIFF header builder from
|
||||||
# https://stackoverflow.com/questions/2641770/extracting-image-from-pdf-with-ccittfaxdecode-filter
|
# https://stackoverflow.com/questions/2641770
|
||||||
tiff_header_struct = '<' + '2s' + 'h' + 'l' + 'h' + 'hhll' * 8 + 'h'
|
tiff_header_struct = '<' + '2s' + 'h' + 'l' + 'h' + 'hhll' * 8 + 'h'
|
||||||
return struct.pack(
|
return struct.pack(
|
||||||
tiff_header_struct,
|
tiff_header_struct,
|
||||||
|
@ -413,7 +413,8 @@ def tiff_header_for_ccitt(width, height, img_size, ccitt_group=4):
|
||||||
258, 3, 1, 1, # BitsPerSample, SHORT, 1, 1
|
258, 3, 1, 1, # BitsPerSample, SHORT, 1, 1
|
||||||
259, 3, 1, ccitt_group, # Compression, SHORT, 1, 4 = CCITT Group 4
|
259, 3, 1, ccitt_group, # Compression, SHORT, 1, 4 = CCITT Group 4
|
||||||
262, 3, 1, 1, # Threshholding, SHORT, 1, 0 = WhiteIsZero
|
262, 3, 1, 1, # Threshholding, SHORT, 1, 0 = WhiteIsZero
|
||||||
273, 4, 1, struct.calcsize(tiff_header_struct), # StripOffsets, LONG, 1, len of header
|
273, 4, 1, struct.calcsize(
|
||||||
|
tiff_header_struct), # StripOffsets, LONG, 1, len of header
|
||||||
278, 4, 1, height, # RowsPerStrip, LONG, 1, lenght
|
278, 4, 1, height, # RowsPerStrip, LONG, 1, lenght
|
||||||
279, 4, 1, img_size, # StripByteCounts, LONG, 1, size of image
|
279, 4, 1, img_size, # StripByteCounts, LONG, 1, size of image
|
||||||
0 # last IFD
|
0 # last IFD
|
||||||
|
|
Loading…
Reference in a new issue