Create JPG image from GIF image

Create JPG image from GIF image

ImageCreateFromGif()

returns an image identifier representing the image obtained from the given filename.

ImageCreateFromJPEG()

returns an image identifier representing the image obtained from the given filename

ImageCreate()

Create a new palette based image

it returns an image identifier representing a blank image of size x_size by y_size.

ImageColorAllocate()

Allocate a color for an image

it returns a color identifier representing the color composed of the given RGB components

ImageFilledRectangle()

creates a filled rectangle of color col in image im starting at upper left coordinates x1, y1 and ending at bottom right coordinates x2, y2. 0, 0 is the top left corner of the image.

ImageString()

draws the string s in the image identified by im at coordinates x, y (top left is 0, 0) in color col. If font is 1, 2, 3, 4 or 5, a built-in font is used.

function LoadGif ($imgname,$des) {

$im = @ImageCreateFromGIF ($imgname);
if (!$im) {
$im = ImageCreate (23, 20); /* Create a blank image */
$bg = ImageColorAllocate ($im, 255, 255, 255);
$tc = ImageColorAllocate ($im, 0, 0, 0);
ImageFilledRectangle ($im, 0, 0, 150, 30, $bg);
/* Output an errmsg */
ImageString($im, 1, 23, 20, “Error loading $imgname”, $tc);
}

$val = imageJPEG($im,$des,100);

$im_old = @ImageCreateFromJPEG ($val);

}

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.