hefronmedia / pdfsizeopt

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

How to build png22pnm for Mac OS X? #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

I'm running Mac OS X 10.7.0 and would like to use pdfsizeopt. I've got 
everything going execept the png22pnm binary because it isnt included for 
sam2p. Where do I get the sourcefiles or a working binary?

Original issue reported on code.google.com by tristan....@gmail.com on 6 Aug 2011 at 12:37

GoogleCodeExporter commented 9 years ago
Build it from source. You will need libpng as well. Get the source of png22pnm 
from here: http://sam2p.googlecode.com/files/tif22pnm-0.12.tar.gz .

Original comment by pts...@gmail.com on 6 Aug 2011 at 6:46

GoogleCodeExporter commented 9 years ago
To make future installations easier, I've uploaded prebuilt Mac OS X binaries 
for sam2p and png22pnm:

http://pdfsizeopt.googlecode.com/files/png22pnm-darwin
http://pdfsizeopt.googlecode.com/files/sam2p-darwin

You don't have to compile these if you don't want to. See 
http://code.google.com/p/pdfsizeopt/wiki/InstallationInstructions how to use 
the binaries above with pdfsizeopt.

Original comment by pts...@gmail.com on 6 Aug 2011 at 7:58

GoogleCodeExporter commented 9 years ago
Thanks. When I try to build png22pnm from source, the bash-script "do.sh" tells 
me "status png22pnm: skipped". Any suggestions? Also one more question 
regarding the compression optimization: every pdf I run through pdfsizeopt 
appears to be just slightly smaller then the original (see the attachment for 
further information). It seems that jbig2 isn't executed properly, but it's 
working when run as a single command. The only why to compile it was through a 
homebrew formula front Misty De Meo: 

http://www.diybookscanner.org/forum/viewtopic.php?f=3&t=683&p=10895#p10895

https://raw.github.com/mistydemeo/homebrew/0c3427ee1e9be6aaaed5a15f8d0d6e63d610d
2f1/Library/Formula/jbig2enc.rb

Do you have a darwin binary for jbig2enc? 

Original comment by tristan....@gmail.com on 7 Aug 2011 at 11:22

Attachments:

GoogleCodeExporter commented 9 years ago
Wrong URL for the formula, here is the new one:

https://raw.github.com/mistydemeo/homebrew/55e72cf6b673d82838ea233022daecd77f738
c99/Library/Formula/jbig2enc.rb

Original comment by tristan....@gmail.com on 7 Aug 2011 at 11:25

GoogleCodeExporter commented 9 years ago
Has the png22pnm problem been solved for you with the binaries I have provided?

> the bash-script "do.sh" tells me "status png22pnm: skipped". Any suggestions?

Most probably the bash script hasn't been properly written -- or you don't have 
libpng installed. Feel free to analyze the script if its output is not verbose 
enough.
Is this a blocker for you? Doesn't the precompiled binary work?

About your jbig2 problem: please create another issue for it. Please attach a 
small input .pdf. Please copy-paste the output of pdfsizeopt (rather than 
attaching).

Original comment by pts...@gmail.com on 7 Aug 2011 at 11:44

GoogleCodeExporter commented 9 years ago
The precompiled binary works but I just wanted to know if you could explain me 
the reason for the skipping of png22pnm.  libpng is installed so it must be 
some other reason. Here's the output from doing ./configure

checking for --enable-debug... assert
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether gcc accepts -ansi -pedantic -Wall -W... yes
checking for ignored -W -Wall -Wnested-externs -Wbad-function-cast 
-Wmissing-declarations... no
checking whether gcc accepts -Wnested-externs -Wbad-function-cast 
-Wmissing-declarations... yes
checking whether gcc accepts -Wstrict-prototypes -Wpointer-arith -Wcast-align 
-Winline -Wcast-qual -Wmissing-prototypes... yes
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking whether cc supports prototypes... yes
checking whether cc compiles standard C... yes
checking for switch(enum) bug... no
checking for ASCII system... yes
checking for an ANSI C-conforming const... yes
checking for C keyword volatile... yes
checking for --with-libtiff-ldir... none
checking for --with-libtiff-idir... none
checking for --with-libpng-ldir... none
checking for --with-libpng-idir... none
checking for library containing TIFFRGBAImageGet... -ltiff
checking for library containing png_create_read_struct... no
checking for working sprintf in stdio.h... yes
checking for working atoi in stdlib.h... yes
checking for working write in unistd.h... yes
checking for working strcpy in string.h... yes
checking for working memcpy in string.h... yes
checking whether memcmp and memcpy are built-in... no
checking whether char is unsigned... no
checking size of char... 1
checking size of short... (cached) 2
checking size of int... (cached) 4
checking size of long... (cached) 8
checking size of long long... 8
checking size of very long... (cached) 0
checking size of __int64... (cached) 0
configure: WARNING: cannot find inttype: sizeof(inttype)==16
checking size of char *... (cached) 8
checking size of void *... 8
checking for an integral type to hold a ptr... long
checking for ptr <-> integral conversion... yes
checking for integral type size_t... unsigned long
checking size of bool... 0
configure: creating ./config.status
config.status: creating cc_help.sh
config.status: creating config.h
config.status: config.h is unchanged
status tif22pnm: to be built (with -ltiff )
status png22pnm: skipped

Original comment by tristan....@gmail.com on 8 Aug 2011 at 4:29

GoogleCodeExporter commented 9 years ago
The most probable reason is that the configure script cannot detect libpng 1.2, 
as indicated by:

checking for library containing png_create_read_struct... no

Original comment by pts...@gmail.com on 8 Aug 2011 at 5:19

GoogleCodeExporter commented 9 years ago
Where does the script search for libpng? I installed it from macports: 
https://trac.macports.org/browser/trunk/dports/graphics/libpng/Portfile .

Original comment by tristan....@gmail.com on 9 Aug 2011 at 4:08

GoogleCodeExporter commented 9 years ago
Sorry, I don't have the capacity for providing support for this script on the 
Mac OS X. My last hint: you don't need the script at all, you can compile with

  gcc -W -Wall -s -O2 -o png22pnm png22pnm.c -lpng -lz

Original comment by pts...@gmail.com on 9 Aug 2011 at 9:17