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():
|
||||
def __getattr__(self, name):
|
||||
return b'/' + name.encode('ascii')
|
||||
|
||||
|
||||
MyPdfName = MyPdfName()
|
||||
|
||||
|
||||
|
@ -708,7 +710,7 @@ def read_images(rawdata, colorspace, first_frame_only=False):
|
|||
ccittdata = transcode_monochrome(imgdata)
|
||||
imgformat = ImageFormat.CCITTGroup4
|
||||
result.append((color, ndpi, imgformat, ccittdata,
|
||||
imgwidthpx, imgheightpx))
|
||||
imgwidthpx, imgheightpx))
|
||||
img_page_count += 1
|
||||
continue
|
||||
except Exception as e:
|
||||
|
@ -1709,5 +1711,6 @@ values set via the --border option.
|
|||
traceback.print_exc(file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -116,6 +116,7 @@ def parsejp2(data):
|
|||
# retrieving the dpi is optional so we do not error out if not present
|
||||
return (width, height, colorspace, hdpi, vdpi)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
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):
|
||||
# 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'
|
||||
return struct.pack(
|
||||
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
|
||||
259, 3, 1, ccitt_group, # Compression, SHORT, 1, 4 = CCITT Group 4
|
||||
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
|
||||
279, 4, 1, img_size, # StripByteCounts, LONG, 1, size of image
|
||||
0 # last IFD
|
||||
|
|
Loading…
Reference in a new issue