Snippets - Utilities
NOTE: Most of the IM snippets have been tested on IM version 6.3.5 There may be some differences if you are using the code on other versions.
New image size in variable - Anthony 26/6/2008
This will resize an image and put the new image details into a vairable. You can either use the variable elsewhere in your code or display it. In this case it is reading the width and height; you should be able to use any of the information for -format.
<?php// Setup the vaiables$sourceFile = "input.jpg";$width = "100";$height = "100";$destinationFile = "output.png";// Displays the output size of the new image$command="convert $sourceFile -resize {$width}x{$height} \( +write $destinationFile \) -format \"%wx%h\" info: ";$output = exec("$command");print("<b>New image size:</b>".$output."<br>");?>
For more examples and information check out the main Imagemagick section.
Batch file ViewFonts installed View
Fonts Installed view View
Gravity option View
http image source View
Image information View
New image size in variable View
Path - find automaticly View
Path to Imagemagick View
Setup Information View
Shell script View
Variables in the code View
Version of Imagemagick installed View
Writing IM code View