<HTML ><HEAD ><TITLE >imagecopyresized</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Image functions" HREF="ref.image.html"><LINK REL="PREVIOUS" TITLE="imagecopyresampled" HREF="function.imagecopyresampled.html"><LINK REL="NEXT" TITLE="imagecreate" HREF="function.imagecreate.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.imagecopyresampled.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.imagecreate.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.imagecopyresized" ></A >imagecopyresized</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN35041" ></A ><P > (PHP 3, PHP 4 )</P >imagecopyresized -- Copy and resize part of an image</DIV ><DIV CLASS="refsect1" ><A NAME="AEN35044" ></A ><H2 >Description</H2 >int <B CLASS="methodname" >imagecopyresized</B > ( resource dst_im, resource src_im, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)<BR ></BR ><P > <B CLASS="function" >imagecopyresized()</B > copies a rectangular portion of one image to another image. <TT CLASS="parameter" ><I >Dst_im</I ></TT > is the destination image, <TT CLASS="parameter" ><I >src_im</I ></TT > is the source image identifier. If the source and destination coordinates and width and heights differ, appropriate stretching or shrinking of the image fragment will be performed. The coordinates refer to the upper left corner. This function can be used to copy regions within the same image (if <TT CLASS="parameter" ><I >dst_im</I ></TT > is the same as <TT CLASS="parameter" ><I >src_im</I ></TT >) but if the regions overlap the results will be unpredictable. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > There is a problem due to palette image limitations (255+1 colors). Resampling or filtering an image commonly needs more colors than 255, a kind of approximation is used to calculate the new resampled pixel and its color. With a palette image we try to allocate a new color, if that failed, we choose the closest (in theory) computed color. This is not always the closest visual color. That may produce a weird result, like blank (or visually blank) images. To skip this problem, please use a truecolor image as a destination image, such as one created by <A HREF="function.imagecreatetruecolor.html" ><B CLASS="function" >imagecreatetruecolor()</B ></A >. </P ></BLOCKQUOTE ></DIV ><P > See also <A HREF="function.imagecopyresampled.html" ><B CLASS="function" >imagecopyresampled()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.imagecopyresampled.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.imagecreate.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >imagecopyresampled</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.image.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >imagecreate</TD ></TR ></TABLE ></DIV ></BODY ></HTML >