Mark Rogers wrote:The "convert" program is being called as part of a PHP script so I can be quite flexible in what I do if I need to be (eg if I need to create dummy images to see what sizes they come out as, etc).
Suggestions for other programs I can use instead welcome. I know ImageMagick and I know I can trust it with high quality images if I need to (and will need to here) which is why I stated there.
Why not use PHP's GD libraries? ... following code is *NOT* tested or even run, i just threw it together.
<?php
$im = imagecreatefrompng("infile.png");
$width = imagesx($im); $height = imagesy($im);
// using imagefttext herebecause it uses truetype fonts but look into freetype fonts function // The text to draw $text = 'Testing...'; // Replace path by your own font path $font = 'arial.ttf';
// Add the text imagettftext($im, $width/$somemagicvar, 0, 10, 20, $black, $font, $text); // the $width / $somemagicvar is what is chanign the size to bein proportional... the outputits a size in pts // you can also do using some function or another to work out the width of the textbefore you render ito nto the image.
imagepng($im, "outfile.png"); ?>