Add option --pillow-limit-break to force Pillow to accept large input images
This commit is contained in:
parent
d9a6c9db03
commit
e78dd80451
1 changed files with 12 additions and 0 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue