1
0
Fork 0
forked from josch/img2pdf

Add option --pillow-limit-break to force Pillow to accept large input images

This commit is contained in:
Johannes 'josch' Schauer 2018-03-24 19:47:03 +01:00
parent d9a6c9db03
commit e78dd80451
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -1644,6 +1644,15 @@ RGB.''')
"input image be converted into a page in the resulting PDF." "input image be converted into a page in the resulting PDF."
) )
outargs.add_argument(
"--pillow-limit-break", action="store_true",
help="img2pdf uses the Python Imaging Library Pillow to read input "
"images. Pillow limits the maximum input image size to %d pixels "
"to prevent decompression bomb denial of service attacks. If "
"your input image contains more pixels than that, use this "
"option to disable this safety measure during this run of img2pdf"
%Image.MAX_IMAGE_PIXELS)
sizeargs = parser.add_argument_group( sizeargs = parser.add_argument_group(
title='Image and page size and layout arguments', title='Image and page size and layout arguments',
description='''\ description='''\
@ -1817,6 +1826,9 @@ values set via the --border option.
if args.verbose: if args.verbose:
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)
if args.pillow_limit_break:
Image.MAX_IMAGE_PIXELS = None
layout_fun = get_layout_fun(args.pagesize, args.imgsize, args.border, layout_fun = get_layout_fun(args.pagesize, args.imgsize, args.border,
args.fit, args.auto_orient) args.fit, args.auto_orient)