Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF compression does not work #202

Closed
pztrick opened this Issue Dec 5, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@pztrick
Copy link

pztrick commented Dec 5, 2014

Wand does not seem to handle Zip compression for PDFs. Not sure if this is a Wand implementation error or ligmagickwand-dev C API related.

The exported PDF from Wand is not flate encoded like it should be.


ImageMagick CLI:

patrick@cyrus:~$ convert -density 100 -compress Zip -verbose before.pdf test.pdf

"gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r100x100"  "-sOutputFile=/tmp/magick-HaIlsaDQ-%08d" "-f/tmp/magick-q0oR0qaR" "-f/tmp/magick-ZLBXviIR"
/tmp/magick-HaIlsaDQ-00000001 PNG 850x1100 850x1100+0+0 8-bit DirectClass 149KB 0.020u 0:00.030
/tmp/magick-HaIlsaDQ-00000002 PNG 850x1100 850x1100+0+0 8-bit DirectClass 140KB 0.030u 0:00.029
/tmp/magick-HaIlsaDQ-00000003 PNG 850x1100 850x1100+0+0 8-bit DirectClass 149KB 0.020u 0:00.040
/tmp/magick-HaIlsaDQ-00000004 PNG 850x1100 850x1100+0+0 8-bit DirectClass 85.3KB 0.020u 0:00.039
/tmp/magick-HaIlsaDQ-00000005 PNG 850x1100 850x1100+0+0 8-bit DirectClass 98.5KB 0.020u 0:00.050
/tmp/magick-HaIlsaDQ-00000006 PNG 850x1100 850x1100+0+0 8-bit DirectClass 80.2KB 0.030u 0:00.070
/tmp/magick-HaIlsaDQ-00000007 PNG 850x1100 850x1100+0+0 8-bit DirectClass 26.2KB 0.020u 0:00.089
before.pdf[0] PDF 850x1100 850x1100+0+0 16-bit DirectClass 149KB 0.160u 0:00.329
before.pdf[1] PDF 850x1100 850x1100+0+0 16-bit DirectClass 149KB 0.130u 0:00.300
before.pdf[2] PDF 850x1100 850x1100+0+0 16-bit DirectClass 149KB 0.110u 0:00.259
before.pdf[3] PDF 850x1100 850x1100+0+0 16-bit DirectClass 149KB 0.090u 0:00.219
before.pdf[4] PDF 850x1100 850x1100+0+0 16-bit DirectClass 149KB 0.060u 0:00.169
before.pdf[5] PDF 850x1100 850x1100+0+0 16-bit DirectClass 149KB 0.020u 0:00.089
before.pdf[6] PDF 850x1100 850x1100+0+0 16-bit DirectClass 149KB 0.000u 0:00.000
before.pdf=>test.pdf[0] PDF 850x1100 850x1100+0+0 16-bit DirectClass 610KB 0.690u 0:00.800

Result: 596kb


Python Wand:

from wand.image import Image4

bef = '/home/patrick/roboshare/before.pdf'
aft = '/home/patrick/roboshare/test2.pdf'

a = Image(filename=bef, resolution=100)
a.compression = 'zip'
a.save(filename=aft)

Result: 1.72MB

@bweigel

This comment has been minimized.

Copy link

bweigel commented Feb 6, 2018

I know this issue is very old, but is there any news on this? I also have noticed, that setting the compression doesn't actually mean the saved file is compressed.

emcconville added a commit that referenced this issue Mar 15, 2019

@emcconville emcconville added this to the 0.5.2 milestone Mar 15, 2019

@emcconville

This comment has been minimized.

Copy link
Owner

emcconville commented Mar 15, 2019

Setting Image.compression now sets both image & image info properties on MagickWand instances

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.