im little noob in this so maybe it will have simple solution

i have installed ImageMagick 6.4.8 on some provider and wanna use it for converting pdf to png for my ebook, so i need to convert it to 3 formats - 1024(for zoomed images) 400(for ebook preview) and 120(for thumbnails). My problem is that my pdfs is differents and i need to have all them with redeable letters.
I have severals problems with it...
if i dont use -density i dont get images where i can easily read the text, but without that parameter i didnt notice any error in any pdf i converted.
if i dont use -depth 8 i got images at 48bits, which is too big - about 6MB per file and if i use it i got 24bit images with 1Mb size, which is ok, but im unable to convert everything fine ;(
when i try to convert few examples pdf with this script...
Code: Select all
<?php
ini_set('max_input_time', 0);
ini_set('max_execution_time', 0);
ini_set('memory_limit', '256M');
ini_set('post_max_size', '64M');
ini_set('upload_max_filesize', '20M');
exec("convert -density 200 $pdf_file1 -quality 90 -resize 1024 -depth 8 page1.png 2>error1.log");
exec("convert -density 200 $pdf_file2 -quality 90 -resize 1024 -depth 8 page2.png 2>error2.log");
exec("convert -density 200 $pdf_file3 -quality 90 -resize 1024 -depth 8 page3.png 2>error3.log");
exec("convert -density 200 $pdf_file4 -quality 90 -resize 1024 -depth 8 page4.png 2>error4.log");
exec("convert -density 200 $pdf_file5 -quality 90 -resize 1024 -depth 8 page5.png 2>error5.log");
exec("convert -density 200 $pdf_file6 -quality 90 -resize 1024 -depth 8 page6.png 2>error6.log");
?>
Code: Select all
error1.log - convert: missing an image filename `page1.png' @ convert.c/ConvertImageCommand/2756.
error3.log - ESP Ghostscript 815.02: Unrecoverable error, exit code 1
error3.log - convert: Postscript delegate failed `/home/citywayc/public_html/test/3.pdf': No such file or directory @ pdf.c/ReadPDFImage/612.
error3.log - convert: missing an image filename `page3.png' @ convert.c/ConvertImageCommand/2756.
error4.log - convert: Memory allocation failed `Cannot allocate memory' @ exception.c/AcquireExceptionInfo/108.
error5.log - ESP Ghostscript 815.02: Unrecoverable error, exit code 1
error5.log - convert: Postscript delegate failed `/home/citywayc/public_html/test/5.pdf': No such file or directory @ pdf.c/ReadPDFImage/612.
error5.log - convert: missing an image filename `page5.png' @ convert.c/ConvertImageCommand/2756.
new error in everything...
convert: `%s': %s "gs" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r200x200" "-sOutputFile=/tmp/magick-XXV3T2G5" "-f/tmp/magick-XXqXQWQD" "-f/tmp/magick-XXBrLX0b" @ utility.c/SystemCommand/1834.
http://www.cityway.com/test/1.pdf
http://www.cityway.com/test/2.pdf
http://www.cityway.com/test/3.pdf
http://www.cityway.com/test/4.pdf
http://www.cityway.com/test/5.pdf
http://www.cityway.com/test/6.pdf
So could you please someone help me, what im doing wrong? I dont mutch care in which format i will have that images i just need to have nice text with them which i can nicely read

Oh i forgot to add just in case the configuration
Code: Select all
[0] =>
[1] => Path: /usr/lib64/ImageMagick-6.4.8/config/configure.xml
[2] =>
[3] => Name Value
[4] => -------------------------------------------------------------------------------
[5] => CC gcc -std=gnu99
[6] => CFLAGS -fopenmp -g -O2 -Wall -W -pthread
[7] => CONFIGURE ./configure '--prefix=/usr' '--libdir=/usr/lib64'
[8] => COPYRIGHT Copyright (C) 1999-2009 ImageMagick Studio LLC
[9] => CPPFLAGS -I/usr/include/ImageMagick
[10] => CXX g++
[11] => CXXFLAGS -g -O2 -Wall -W -pthread
[12] => DEFS -DHAVE_CONFIG_H
[13] => DELEGATES bzlib fontconfig freetype gs jpeg png rsvg tiff x11 xml wmf zlib
[14] => DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-fontpath=
[15] => EXEC-PREFIX /usr
[16] => HOST x86_64-unknown-linux-gnu
[17] => LDFLAGS -L/usr/lib64 -lfreetype
[18] => LIB_VERSION 0x648
[19] => LIB_VERSION_NUMBER 6,4,8,2
[20] => LIBS -lMagickCore -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lbz2 -lz -lm -lgomp -lpthread
[21] => NAME ImageMagick
[22] => PCFLAGS -fopenmp
[23] => PREFIX /usr
[24] => QuantumDepth 16
[25] => RELEASE_DATE 2010-09-21
[26] => VERSION 6.4.8
[27] => WEBSITE http://www.imagemagick.org