Closed
Description
Hi, @pts.
I just found a PDF file that makes pdfsizeopt die with an assertion being thrown. The file in question is a book by Terence Tao (a Fields medalist, BTW), available at:
https://terrytao.files.wordpress.com/2011/06/blog-book.pdf
Since the PDF at that site may get recompiled (I'm not sure), I am attaching the version that causes problems here.
The problem that I get is the following (edited for brevity):
$ pdfsizeopt --use-image-optimizer=jbig2 --use-multivalent=no blog-book.pdf
info: This is pdfsizeopt rUNKNOWN size=401569.
info: prepending to PATH: /home/rbrito/Downloads/pdfsizeopt
info: loading PDF from: blog-book.pdf
info: loaded PDF of 1443649 bytes
info: separated to 990 objs + xref + trailer
info: parsed 990 objs
info: found 31 Type1 fonts loaded
info: writing Type1CConverter (427868 font bytes) to: /home/rbrito/tmp/psotmp.4197.conv.tmp.ps
info: using Ghostscript TMPDIR=/home/rbrito/tmp TEMP=/home/rbrito/tmp gs: GPL Ghostscript 9.22 (2017-10-04)
info: executing Type1CConverter with Ghostscript: TMPDIR=/home/rbrito/tmp TEMP=/home/rbrito/tmp gs -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=/home/rbrito/tmp/psotmp.4197.conv.tmp.pdf -f /home/rbrito/tmp/psotmp.4197.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 922 20171004
Type1CConverter: converting font /TNVJUX+CMBX10 to /Obj0000000917
(...)
info: will optimize image XObject 248; orig width=318 height=298 colorspace=/DeviceRGB bpc=8 inv=False filter=/FlateDecode dp=1 size=4251 gs_device=png16m
info: saving PNG to /home/rbrito/tmp/psotmp.4197.img-248.parse.png
info: written 4077 bytes to PNG
(...)
info: executing image converter sam2p_np: sam2p -j:quiet -pdf:2 -c zip:1:9 -s Gray1:Indexed1:Gray2:Indexed2:Rgb1:Gray4:Indexed4:Rgb2:Gray8:Indexed8:Rgb4:Rgb8:stop -- /home/rbrito/tmp/psotmp.4197.img-248.parse.png /home/rbrito/tmp/psotmp.4197.img-248.sam2p-np.pdf
info: loading image from: /home/rbrito/tmp/psotmp.4197.img-248.sam2p-np.pdf
info: loading PDF from: /home/rbrito/tmp/psotmp.4197.img-248.sam2p-np.pdf
info: loaded PDF of 3149 bytes
info: separated to 5 objs + xref + trailer
info: parsed 5 objs
info: loaded PNG IDAT of 2441 bytes
info: saving PNG to /home/rbrito/tmp/psotmp.4197.img-248.save-oi.png
Traceback (most recent call last):
File "/home/rbrito/Downloads/pdfsizeopt/pdfsizeopt", line 41, in <module>
sys.exit(main.main(sys.argv, script_dir=script_dir))
File "/home/rbrito/Downloads/pdfsizeopt/lib/pdfsizeopt/main.py", line 9677, in main
do_fast_bilevel_images=f.do_fast_bilevel_images)
File "/home/rbrito/Downloads/pdfsizeopt/lib/pdfsizeopt/main.py", line 7676, in OptimizeImages
.SavePng(file_name=TMP_PREFIX + 'img-%d.save-oi.png' % obj_num)
File "/home/rbrito/Downloads/pdfsizeopt/lib/pdfsizeopt/main.py", line 4201, in SavePng
assert self.CanBePngImage()
AssertionError
$
Please, let me know if you can reproduce the problem. If not, I will provide as many details as I can.
Thanks,
Rogério Brito.
Metadata
Assignees
Labels
No labels