title: improve quality of PHP GD generated images
body: <p>i am going to start building a map generator in PHP using the GD library. i generated some images using the lib but they don't have a good quality. I just want to know that is there some way to improve the quality of the images.</p>
  
  <p>The generated image is:</p>
  
  <p><img src="https://i.stack.imgur.com/E0Hju.jpg" alt="the img"></p>
  
  <p>and the code i made is:</p>
  
  <pre><code>&lt;?php
  
  $canvas = imagecreate(800, 350);
  
  imagecolorallocate($canvas, 255, 255, 255);
  
  $pink = imagecolorallocate($canvas, 255, 105, 180);
  $white = imagecolorallocate($canvas, 255, 255, 255);
  $green = imagecolorallocate($canvas, 132, 135, 28);
  
  imagestring( $canvas, 20, 290, 25, "Quality is not the best :(", $green );
  function drawlinebox($x1, $y1, $x2, $y2, $height, $color){
      global $canvas;
      imagesetthickness ( $canvas, 1 );
      for ($i=1; $i &lt; $height; $i++){
          imageline( $canvas, $x1, $y1, $x2, $y2, $color );
          $y1++; $y2++;
      }
  }
  
  drawlinebox(20, 20, 780, 300, 30, $green);
  drawlinebox(20, 300, 780, 20, 30, $pink);
  header('Content-Type: image/jpeg');
  imagejpeg($canvas);
  imagedestroy($canvas);
  
  ?&gt;
  </code></pre>