Page 1 of 1
Unrecognized image compression PNG
Posted: 2014-10-29T11:46:36-07:00
by szahn
When I run the following command to annotate a pdf and compress it with PNG, I get an error saying PNG is not a valid compression.
convert.exe doc.pdf -compress PNG -font Arial -pointsize 12 -fill black -stroke white -strokewidth 5 -gravity south -annotate +0+0 "Test -stroke none -gravity south -annotate +0+0 "Test" doc.pdf
convert.exe: unrecognized image compression `PNG'
From what I've researched, I need to either recompile ImageMagick with LibPng or add a png delegate to delegates.xml. However, I can't find any documentation on how to exactly do this on a Windows system. Can anyone provide me step by step instructions on how to include PNG (libpng) compression support. I understand that I need to recompile ImageMagick. I've tried this with the VisualMagick solution and ran the configure.exe wizard but I don't see anywhere where I can tell IM to include libpng.
Re: Unrecognized image compression PNG
Posted: 2014-10-29T12:27:54-07:00
by fmw42
As far as I know IM does not have any PNG compression option for -comporess.
see
http://www.imagemagick.org/script/comma ... p#compress
Also you can check your compression options using
convert -list compress
B44
B44A
BZip
DXT1
DXT3
DXT5
Fax
Group4
JBIG1
JBIG2
JPEG
JPEG2000
Lossless
LosslessJPEG
LZMA
LZW
None
Piz
Pxr24
RLE
Zip
RunlengthEncoded
ZipS
P.S. It is always a good idea to identify your version of IM and platform when posting a question.
Re: Unrecognized image compression PNG
Posted: 2014-10-29T12:42:44-07:00
by szahn
IM version is 6.8.9 and platform is Windows 8.1 64-bit.
I thought IM can be extended with delegates. So, you cannot add PNG compression support using LibPng with delegates? This appears to be a major letdown.
This is what I get
convert.exe -list compress
B44
B44A
BZip
DXT1
DXT3
DXT5
Fax
Group4
JBIG1
JBIG2
JPEG
JPEG2000
Lossless
LosslessJPEG
LZMA
LZW
None
Piz
Pxr24
RLE
Zip
RunlengthEncoded
ZipS
Re: Unrecognized image compression PNG
Posted: 2014-10-29T12:44:42-07:00
by szahn
The reason I want to try PNG compression is that compressing a PDF with JPEG/2000 compression produces a bad quality image no matter what the -quality parameter is. Since i'm not satisfied with the JPEG compression quality, I'm looking for better image formats that promise small file size and good image quality. Since I can't find a suitable one in IM, I will have to look for another library.
Re: Unrecognized image compression PNG
Posted: 2014-10-29T12:48:29-07:00
by Bonzo
Re: Unrecognized image compression PNG
Posted: 2014-10-29T14:38:26-07:00
by fmw42
Perhaps you should convert to an intermediate PNG image (removing the -compression) and use the -quality settings for PNG and then convert to PDF.
convert.exe doc.pdf -font Arial -pointsize 12 -fill black -stroke white -strokewidth 5 -gravity south -annotate +0+0 "Test -stroke none -gravity south -annotate +0+0 "Test"
-quality XX PNG:- | convert - doc.pdf
See -quality
http://www.imagemagick.org/script/comma ... hp#quality
Note PNG quality settings are different from what you would use for JPG
Also note that IM is not a good vector-to-vector format processor. IM will rasterize your input pdf, put the text on it, then put the resulting raster image into a vector shell. But it will still basically be a raster image.
Re: Unrecognized image compression PNG
Posted: 2014-10-29T14:40:33-07:00
by szahn
Thanks for the responses. That looks like a possible solution. However, I've switched to using iText as it can create text stamps quite nicely.