DJ Mike's Tutorials: PHP

ImageMagick Functions

^

Imagick::SetImageFormat

Description:
bool Imagick::setImageFormat ( string $format )

Sets the format of a particular image in a sequence.
Parameters:
format: String presentation of the image format. Format support depends on the ImageMagick installation.
Return Values
Returns TRUE on success.

Example


jpeg

gif


<?php
# Change a JPEG to a GIF
# Create a file resource
$url "http://eclecticdjs.com/mike/temp/08/06/imagick/opossum.jpg";
$filehandle fopen"$url""r");
# Create Imagick object
$image = new Imagick(); 
# Read the file resource
$image->readimagefile($filehandle);
# Change the format
$image->setimageformat("gif");
# Make correct headers for new format.
header("Content-type: image/gif");
# Send Image to browser
echo $image;
?> 


^


Created by DJ Mike from Santa Barbara

DJ Mike


Dance Away Santa Barbara's Home Page
<a href="http://www.statcounter.com/" target="_blank"> <img src="http://c5.statcounter.com/counter.php?sc_project=1321035&java=0&security=da2193dc" alt="counter free hit invisible" border="0" /></a>