![]() net: TIFF format and tags: """ def tiff_header_for_CCITT(width, height, img_size, CCITT_group=4): tiff_header_struct = ' 0 - Mixed one- and two-dimensional encoding (Group 3, 2-D) """ if xObject = '/CCITTFaxDecode': if xObject = -1: CCITT_group = 4 else: CCITT_group = 3 width = xObject height = xObject data = xObject._data # sorry, getData() does not work for CCITTFaxDecode img_size = len(data) tiff_header = tiff_header_for_CCITT(width, height, img_size, CCITT_group) img_name = obj + '.tiff' with open(img_name, 'wb') as img_file: img_file.write(tiff_header + data) # import io # from PIL import Image # im = Image.open(io.BytesIO(tiff_header + data)) pdf_file.close() В Python с PyPDF2 для фильтра CCITTFaxDecode: import PyPDF2 import struct """ Links: PDF format: CCITT Group 4: !!PDF-E&type=items Extract images from pdf: Extract images coded with CCITTFaxDecode in.
0 Comments
Leave a Reply. |