Click here to Skip to main content
15,867,986 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am using imagemagick to convert pdf file to images.. but when the file is converted into png images its background color changes (gray color)...
when file is converted into jpg image then it's font is effected and does not give clear visibility..
Kindly guide me how to remain the images as the same format as pdf file...

the code to convert pdf to jpg is:

VB
<?php

shell_exec("convert  annots.pdf i.jpg");

?>
Posted
Comments
Sergey Alexandrovich Kryukov 4-Sep-12 11:20am    
Are you sure you need to change resolution? Would you be surprised to know that this is just a part of metadata which may or may not be available and do not actually effect anything? More likely, you need to re-sample the image on the fly.
--SA

1 solution

Please see my comment to the question. More likely that you need to resample the image. I assume you failed to find what you need in the documentation just because you did not know correct term. Now you can find it out:
http://en.wikipedia.org/wiki/ImageMagick[^],
http://www.imagemagick.org/script/index.php[^],
http://www.imagemagick.org/script/command-line-processing.php[^],
http://www.imagemagick.org/script/command-line-options.php[^].

However, I don't think you should use PHP shell_exec and the command line interface at all; this is always a bad idea to start an external process on HTTP request, a kind of a last resort. You can use PHP programming interface to ImageMagic:
http://php.net/manual/en/book.imagick.php[^].

Good luck,
—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900