<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/refs.utilspec.image.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'book.image.php',
    1 => 'GD',
    2 => 'Image Processing and GD',
  ),
  'up' => 
  array (
    0 => 'refs.utilspec.image.php',
    1 => 'Processamento e generazione di immagini',
  ),
  'prev' => 
  array (
    0 => 'function.read-exif-data.php',
    1 => 'read_exif_data',
  ),
  'next' => 
  array (
    0 => 'image.setup.php',
    1 => 'Installazione/Configurazione',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/image/book.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/book.image.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="book.image" class="book">
 
 <h1 class="title">Image Processing and GD</h1>
 
 
 
 <div id="intro.image" class="preface">
  <h1 class="title">Introduzione</h1>
  <p class="para">
   PHP is not limited to creating just HTML output.  It can also be
   used to create and manipulate image files in a variety of different
   image formats, including <abbr title="Graphic Interchange Format">GIF</abbr>, <abbr title="Portable Network Graphics">PNG</abbr>,
   <abbr title="Joint Photographic Experts Group">JPEG</abbr>, <abbr title="Wireless Bitmap">WBMP</abbr>, and <abbr>XPM</abbr>.
   Even more conveniently, PHP can output image streams directly to a browser. You
   will need to compile PHP with the <abbr title="Graphics Draw">GD</abbr> library of image
   functions for this to work. <abbr title="Graphics Draw">GD</abbr> and PHP may also require
   other libraries, depending on which image formats you want to work with.
  </p>
  <p class="para">
   You can use the image functions in PHP to get the size of
   <abbr title="Joint Photographic Experts Group">JPEG</abbr>, <abbr title="Graphic Interchange Format">GIF</abbr>,
   <abbr title="Portable Network Graphics">PNG</abbr>, <abbr title="Shockwave Flash">SWF</abbr>,
   <abbr title="Tagged Image File Format">TIFF</abbr> and <abbr>JPEG2000</abbr> images.
  </p>
  <p class="para">
   With the <a href="ref.exif.php" class="link">exif extension</a>, you are able
   to work with information stored in headers of
   <abbr title="Joint Photographic Experts Group">JPEG</abbr> and <abbr title="Tagged Image File Format">TIFF</abbr> images. This way you can
   read meta data generated by digital cameras. The exif
   functions do not require the <abbr title="Graphics Draw">GD</abbr> library.
  </p>
  
  <p class="para">
   <blockquote class="note"><p><strong class="note">Nota</strong>: 
    <span class="simpara">
     Read the requirements section about how to expand image capabilities
     to read, write and modify images. To read meta data of pictures
     taken by digital cameras you need the above mentioned
     <a href="ref.exif.php" class="link">exif extension</a>.
    </span>
   </p></blockquote>
   <blockquote class="note"><p><strong class="note">Nota</strong>: 
    <span class="simpara">
      The <span class="function"><a href="function.getimagesize.php" class="function">getimagesize()</a></span> function does not require the GD extension.
    </span>
   </p></blockquote>
   <div class="caution"><strong class="caution">Attenzione</strong>
    <p class="simpara">
     While the bundled version of the GD library uses the Zend memory manager to
     allocate memory, system versions do not, so that <a href="ini.core.php#ini.memory-limit" class="link">memory_limit</a> does not apply. 
    </p>
   </div>
  </p>

  <p class="para">
   GD supports a varity of formats, below is a list of formats supported by GD and notes 
   to their availability including read/write support.
  </p>
  <p class="para">
   <table class="doctable table">
    <caption><strong>Formats supported by GD</strong></caption>
    
     <thead>
      <tr>
       <th>Format</th>
       <th>Read support</th>
       <th>Write support</th>
       <th>Notes</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>JPEG</td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td>PNG</td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td>GIF</td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td>XBM</td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td>XPM</td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td><strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td>WBMP</td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td>WebP</td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td>BMP</td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></td>
       <td>Available as of PHP 7.2.0</td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="para">
   Despite most formats being available for both reading and writing in the above table, doesn&#039;t 
   mean that PHP was compiled with support for them. To find out which formats that was available 
   to GD during compilation, use the <span class="function"><a href="function.gd-info.php" class="function">gd_info()</a></span> function, for more information 
   about compiling support for one or more formats, see the installation chapter.
  </p>
 </div>

 
 
 







 




 







 






 




 




<ul class="chunklist chunklist_book"><li><a href="image.setup.php">Installazione/Configurazione</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="image.requirements.php">Requisiti</a></li><li><a href="image.installation.php">Installazione</a></li><li><a href="image.configuration.php">Configurazione di Runtime</a></li><li><a href="image.resources.php">Tipi di risorse</a></li></ul></li><li><a href="image.constants.php">Costanti predefinite</a></li><li><a href="image.examples.php">Esempi</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="image.examples-png.php">PNG creation with PHP</a></li><li><a href="image.examples-watermark.php">Adding watermarks to images using alpha channels</a></li><li><a href="image.examples.merged-watermark.php">Using imagecopymerge to create a translucent watermark</a></li></ul></li><li><a href="ref.image.php">GD and Image Funzioni</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.gd-info.php">gd_info</a> — Retrieve information about the currently installed GD library</li><li><a href="function.getimagesize.php">getimagesize</a> — Get the size of an image</li><li><a href="function.getimagesizefromstring.php">getimagesizefromstring</a> — Get the size of an image from a string</li><li><a href="function.image-type-to-extension.php">image_type_to_extension</a> — Get file extension for image type</li><li><a href="function.image-type-to-mime-type.php">image_type_to_mime_type</a> — Get Mime-Type for image-type returned by getimagesize,
   exif_read_data, exif_thumbnail, exif_imagetype</li><li><a href="function.image2wbmp.php">image2wbmp</a> — Invia l'immagine al browser o in un file</li><li><a href="function.imageaffine.php">imageaffine</a> — Return an image containing the affine transformed src image, using an optional clipping area</li><li><a href="function.imageaffinematrixconcat.php">imageaffinematrixconcat</a> — Concatenate two affine transformation matrices</li><li><a href="function.imageaffinematrixget.php">imageaffinematrixget</a> — Get an affine transformation matrix</li><li><a href="function.imagealphablending.php">imagealphablending</a> — Set the blending mode for an image</li><li><a href="function.imageantialias.php">imageantialias</a> — Should antialias functions be used or not</li><li><a href="function.imagearc.php">imagearc</a> — Draws an arc</li><li><a href="function.imageavif.php">imageavif</a> — Invia l'immagine al browser o in un file</li><li><a href="function.imagebmp.php">imagebmp</a> — Output a BMP image to browser or file</li><li><a href="function.imagechar.php">imagechar</a> — Draw a character horizontally</li><li><a href="function.imagecharup.php">imagecharup</a> — Draw a character vertically</li><li><a href="function.imagecolorallocate.php">imagecolorallocate</a> — Allocate a color for an image</li><li><a href="function.imagecolorallocatealpha.php">imagecolorallocatealpha</a> — Allocate a color for an image</li><li><a href="function.imagecolorat.php">imagecolorat</a> — Get the index of the color of a pixel</li><li><a href="function.imagecolorclosest.php">imagecolorclosest</a> — Get the index of the closest color to the specified color</li><li><a href="function.imagecolorclosestalpha.php">imagecolorclosestalpha</a> — Get the index of the closest color to the specified color + alpha</li><li><a href="function.imagecolorclosesthwb.php">imagecolorclosesthwb</a> — Get the index of the color which has the hue, white and blackness</li><li><a href="function.imagecolordeallocate.php">imagecolordeallocate</a> — De-allocate a color for an image</li><li><a href="function.imagecolorexact.php">imagecolorexact</a> — Get the index of the specified color</li><li><a href="function.imagecolorexactalpha.php">imagecolorexactalpha</a> — Get the index of the specified color + alpha</li><li><a href="function.imagecolormatch.php">imagecolormatch</a> — Makes the colors of the palette version of an image more closely match the true color version</li><li><a href="function.imagecolorresolve.php">imagecolorresolve</a> — Get the index of the specified color or its closest possible alternative</li><li><a href="function.imagecolorresolvealpha.php">imagecolorresolvealpha</a> — Get the index of the specified color + alpha or its closest possible alternative</li><li><a href="function.imagecolorset.php">imagecolorset</a> — Set the color for the specified palette index</li><li><a href="function.imagecolorsforindex.php">imagecolorsforindex</a> — Get the colors for an index</li><li><a href="function.imagecolorstotal.php">imagecolorstotal</a> — Find out the number of colors in an image's palette</li><li><a href="function.imagecolortransparent.php">imagecolortransparent</a> — Define a color as transparent</li><li><a href="function.imageconvolution.php">imageconvolution</a> — Apply a 3x3 convolution matrix, using coefficient and offset</li><li><a href="function.imagecopy.php">imagecopy</a> — Copy part of an image</li><li><a href="function.imagecopymerge.php">imagecopymerge</a> — Copy and merge part of an image</li><li><a href="function.imagecopymergegray.php">imagecopymergegray</a> — Copy and merge part of an image with gray scale</li><li><a href="function.imagecopyresampled.php">imagecopyresampled</a> — Copy and resize part of an image with resampling</li><li><a href="function.imagecopyresized.php">imagecopyresized</a> — Copy and resize part of an image</li><li><a href="function.imagecreate.php">imagecreate</a> — Create a new palette based image</li><li><a href="function.imagecreatefromavif.php">imagecreatefromavif</a> — Crea una nuova immagine da un file o una URL</li><li><a href="function.imagecreatefrombmp.php">imagecreatefrombmp</a> — Crea una nuova immagine da un file o una URL</li><li><a href="function.imagecreatefromgd.php">imagecreatefromgd</a> — Create a new image from GD file or URL</li><li><a href="function.imagecreatefromgd2.php">imagecreatefromgd2</a> — Create a new image from GD2 file or URL</li><li><a href="function.imagecreatefromgd2part.php">imagecreatefromgd2part</a> — Create a new image from a given part of GD2 file or URL</li><li><a href="function.imagecreatefromgif.php">imagecreatefromgif</a> — Crea una nuova immagine da un file o una URL</li><li><a href="function.imagecreatefromjpeg.php">imagecreatefromjpeg</a> — Crea una nuova immagine da un file o una URL</li><li><a href="function.imagecreatefrompng.php">imagecreatefrompng</a> — Crea una nuova immagine da un file o una URL</li><li><a href="function.imagecreatefromstring.php">imagecreatefromstring</a> — Create a new image from the image stream in the string</li><li><a href="function.imagecreatefromtga.php">imagecreatefromtga</a> — Crea una nuova immagine da un file o una URL</li><li><a href="function.imagecreatefromwbmp.php">imagecreatefromwbmp</a> — Crea una nuova immagine da un file o una URL</li><li><a href="function.imagecreatefromwebp.php">imagecreatefromwebp</a> — Crea una nuova immagine da un file o una URL</li><li><a href="function.imagecreatefromxbm.php">imagecreatefromxbm</a> — Crea una nuova immagine da un file o una URL</li><li><a href="function.imagecreatefromxpm.php">imagecreatefromxpm</a> — Crea una nuova immagine da un file o una URL</li><li><a href="function.imagecreatetruecolor.php">imagecreatetruecolor</a> — Create a new true color image</li><li><a href="function.imagecrop.php">imagecrop</a> — Crop an image to the given rectangle</li><li><a href="function.imagecropauto.php">imagecropauto</a> — Crop an image automatically using one of the available modes</li><li><a href="function.imagedashedline.php">imagedashedline</a> — Draw a dashed line</li><li><a href="function.imagedestroy.php">imagedestroy</a> — Destroy an image</li><li><a href="function.imageellipse.php">imageellipse</a> — Draw an ellipse</li><li><a href="function.imagefill.php">imagefill</a> — Flood fill</li><li><a href="function.imagefilledarc.php">imagefilledarc</a> — Draw a partial arc and fill it</li><li><a href="function.imagefilledellipse.php">imagefilledellipse</a> — Draw a filled ellipse</li><li><a href="function.imagefilledpolygon.php">imagefilledpolygon</a> — Draw a filled polygon</li><li><a href="function.imagefilledrectangle.php">imagefilledrectangle</a> — Draw a filled rectangle</li><li><a href="function.imagefilltoborder.php">imagefilltoborder</a> — Flood fill to specific color</li><li><a href="function.imagefilter.php">imagefilter</a> — Applies a filter to an image</li><li><a href="function.imageflip.php">imageflip</a> — Flips an image using a given mode</li><li><a href="function.imagefontheight.php">imagefontheight</a> — Get font height</li><li><a href="function.imagefontwidth.php">imagefontwidth</a> — Get font width</li><li><a href="function.imageftbbox.php">imageftbbox</a> — Give the bounding box of a text using fonts via freetype2</li><li><a href="function.imagefttext.php">imagefttext</a> — Write text to the image using fonts using FreeType 2</li><li><a href="function.imagegammacorrect.php">imagegammacorrect</a> — Apply a gamma correction to a GD image</li><li><a href="function.imagegd.php">imagegd</a> — Output GD image to browser or file</li><li><a href="function.imagegd2.php">imagegd2</a> — Output GD2 image to browser or file</li><li><a href="function.imagegetclip.php">imagegetclip</a> — Get the clipping rectangle</li><li><a href="function.imagegetinterpolation.php">imagegetinterpolation</a> — Get the interpolation method</li><li><a href="function.imagegif.php">imagegif</a> — Invia l'immagine al browser o in un file</li><li><a href="function.imagegrabscreen.php">imagegrabscreen</a> — Captures the whole screen</li><li><a href="function.imagegrabwindow.php">imagegrabwindow</a> — Captures a window</li><li><a href="function.imageinterlace.php">imageinterlace</a> — Enable or disable interlace</li><li><a href="function.imageistruecolor.php">imageistruecolor</a> — Finds whether an image is a truecolor image</li><li><a href="function.imagejpeg.php">imagejpeg</a> — Invia l'immagine al browser o in un file</li><li><a href="function.imagelayereffect.php">imagelayereffect</a> — Set the alpha blending flag to use layering effects</li><li><a href="function.imageline.php">imageline</a> — Draw a line</li><li><a href="function.imageloadfont.php">imageloadfont</a> — Load a new font</li><li><a href="function.imageopenpolygon.php">imageopenpolygon</a> — Draws an open polygon</li><li><a href="function.imagepalettecopy.php">imagepalettecopy</a> — Copy the palette from one image to another</li><li><a href="function.imagepalettetotruecolor.php">imagepalettetotruecolor</a> — Converts a palette based image to true color</li><li><a href="function.imagepng.php">imagepng</a> — Output a PNG image to either the browser or a file</li><li><a href="function.imagepolygon.php">imagepolygon</a> — Draws a polygon</li><li><a href="function.imagerectangle.php">imagerectangle</a> — Draw a rectangle</li><li><a href="function.imageresolution.php">imageresolution</a> — Get or set the resolution of the image</li><li><a href="function.imagerotate.php">imagerotate</a> — Rotate an image with a given angle</li><li><a href="function.imagesavealpha.php">imagesavealpha</a> — Whether to retain full alpha channel information when saving images</li><li><a href="function.imagescale.php">imagescale</a> — Scale an image using the given new width and height</li><li><a href="function.imagesetbrush.php">imagesetbrush</a> — Set the brush image for line drawing</li><li><a href="function.imagesetclip.php">imagesetclip</a> — Set the clipping rectangle</li><li><a href="function.imagesetinterpolation.php">imagesetinterpolation</a> — Set the interpolation method</li><li><a href="function.imagesetpixel.php">imagesetpixel</a> — Set a single pixel</li><li><a href="function.imagesetstyle.php">imagesetstyle</a> — Set the style for line drawing</li><li><a href="function.imagesetthickness.php">imagesetthickness</a> — Set the thickness for line drawing</li><li><a href="function.imagesettile.php">imagesettile</a> — Set the tile image for filling</li><li><a href="function.imagestring.php">imagestring</a> — Draw a string horizontally</li><li><a href="function.imagestringup.php">imagestringup</a> — Draw a string vertically</li><li><a href="function.imagesx.php">imagesx</a> — Get image width</li><li><a href="function.imagesy.php">imagesy</a> — Get image height</li><li><a href="function.imagetruecolortopalette.php">imagetruecolortopalette</a> — Convert a true color image to a palette image</li><li><a href="function.imagettfbbox.php">imagettfbbox</a> — Give the bounding box of a text using TrueType fonts</li><li><a href="function.imagettftext.php">imagettftext</a> — Write text to the image using TrueType fonts</li><li><a href="function.imagetypes.php">imagetypes</a> — Return the image types supported by this PHP build</li><li><a href="function.imagewbmp.php">imagewbmp</a> — Invia l'immagine al browser o in un file</li><li><a href="function.imagewebp.php">imagewebp</a> — Output a WebP image to browser or file</li><li><a href="function.imagexbm.php">imagexbm</a> — Output an XBM image to browser or file</li><li><a href="function.iptcembed.php">iptcembed</a> — Embeds binary IPTC data into a JPEG image</li><li><a href="function.iptcparse.php">iptcparse</a> — Parse a binary IPTC block into single tags</li><li><a href="function.jpeg2wbmp.php">jpeg2wbmp</a> — Convert JPEG image file to WBMP image file</li><li><a href="function.png2wbmp.php">png2wbmp</a> — Convert PNG image file to WBMP image file</li></ul></li><li><a href="class.gdimage.php">GdImage</a> — The GdImage class</li><li><a href="class.gdfont.php">GdFont</a> — The GdFont class</li></ul></div><?php manual_footer($setup); ?>