keep same quality png imagemagick

69 views Asked by At

So I am attempting to write text to a base image - which works. But the issue I am having is that when the image is re-rendered, it doesn't keep the same quality of the image as the original.

Bad image quality: http://screencast.com/t/1XrcJTta

Good Image quality: http://screencast.com/t/dktPKT4dr

I am just using standard practice for writing text to the image as seen here:

      //Set the Content Type
  header('Content-type: image/png');

  // Create Image From Existing File
  $png_image = imagecreatefrompng('advisors_21.png');

  // Allocate A Color For The Text
  $white = imagecolorallocate($jpg_image, 255, 255, 255);

  // Set Path to Font File
  $font_path = 'fast99.ttf';

  // Set Text to Be Printed On Image
  $text = "$1.99";

  // Print Text On Image
  imagettftext($png_image, 14, 40, 29, 56, $white, $font_path, $text);

  // Send Image to Browser
  $image1 = imagepng($png_image);

  // Clear Memory
  imagedestroy($png_image);

What is missing that would allow the image to keep the same quality it originally started with? The original image is in fact a png image.

0

There are 0 answers