hefronmedia / pdfsizeopt

Automatically exported from code.google.com/p/pdfsizeopt
0 stars 0 forks source link

assert len(palette) % 3 == 0 #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
(Please select a label starting with Optimize- in ``Labels:'' below, and
remove this paragraph.)

What command do you run to optimize the PDF?
user@ubuntu804server:~/pdfsizeopt$ ./pdfsizeopt.py --use-pngout=false
--use-jbig2=true --use-multivalent=true --do-unify-fonts=false vrabimintest.pdf

What does pdfsizeopt display when running the command above?
info: This is pdfsizeopt.py r95.
info: loading PDF from: vrabimintest.pdf
info: loaded PDF of 94956 bytes
info: separated to 39 objs
info: found 0 Type1 fonts loaded
Traceback (most recent call last):
  File "./pdfsizeopt.py", line 6027, in ?
    main(sys.argv)
  File "./pdfsizeopt.py", line 6016, in main
    pdf.OptimizeImages(use_pngout=use_pngout, use_jbig2=use_jbig2)
  File "./pdfsizeopt.py", line 4804, in OptimizeImages
    if not PdfObj.IsGrayColorSpace(colorspace):
  File "./pdfsizeopt.py", line 1503, in IsGrayColorSpace
    assert len(palette) % 3 == 0
AssertionError

What's wrong with the optimized PDF?
There isn't one!

Original issue reported on code.google.com by lev.bishop on 29 Oct 2009 at 6:54

Attachments:

GoogleCodeExporter commented 9 years ago
Please update to r97 and try again. It should work.

By the way, the PDF generator is buggy, because it generates and RGB palette of 
size
25 (with an extra \n at the end). Nevertheless, r97 of pdfsizeopt.py now 
accepts this
buggy PDF, and ignores the extra \n.

Original comment by pts...@gmail.com on 31 Oct 2009 at 9:23

GoogleCodeExporter commented 9 years ago
Doesn't seem to be working:
user@ubuntu804server:~/pdfsizeopt$ ./pdfsizeopt.py vrabimintest.pdf
info: This is pdfsizeopt.py r101.
info: loading PDF from: vrabimintest.pdf
info: loaded PDF of 94956 bytes
info: separated to 39 objs
info: found 0 Type1 fonts loaded
info: found 0 Type1C fonts loaded
Traceback (most recent call last):
  File "./pdfsizeopt.py", line 6121, in ?
    main(sys.argv)
  File "./pdfsizeopt.py", line 6107, in main
    pdf.OptimizeImages(use_pngout=use_pngout, use_jbig2=use_jbig2)
  File "./pdfsizeopt.py", line 4844, in OptimizeImages
    if name == 'DecodeParms' and '/JBIG2Globals' in value:
TypeError: iterable argument required

The pdf generator is windows' acrobat 7.0.5 distiller (via the Adobe pdf 
converter
printer driver in), printed from wolfram mathematica 6.0.0

Original comment by lev.bishop on 31 Oct 2009 at 6:21

GoogleCodeExporter commented 9 years ago
Please update to r102. It should work now.

Original comment by pts...@gmail.com on 31 Oct 2009 at 7:37

GoogleCodeExporter commented 9 years ago

Original comment by pts...@gmail.com on 31 Oct 2009 at 7:37

GoogleCodeExporter commented 9 years ago
Confirm fixed.

Original comment by lev.bishop on 31 Oct 2009 at 8:00