我需要在ImageMagick或GD库之间进行选择,以执行以下图像处理任务:
如你所见,我不需要任何花哨的东西.我确信这两个工具都可以实现它们,所以如果一个人有比另一个更多的额外功能,我真的不在乎.
我主要关心的是性能和质量.这两种工具中哪一种消耗的资源更少,速度更快,产生更高质量的图像?
PS我需要将它与各自的PHP API一起使用.
我使用以下函数从我的PHP脚本创建固定高度和宽度的缩略图
/*creates thumbnail of required dimensions*/
function createThumbnailofSize($sourcefilepath,$destdir,$reqwidth,$reqheight,$aspectratio=false)
{
/*
* $sourcefilepath = absolute source file path of jpeg
* $destdir = absolute path of destination directory of thumbnail ending with "/"
*/
$thumbWidth = $reqwidth; /*pixels*/
$filename = split("[/\\]",$sourcefilepath);
$filename = $filename[count($filename)-1];
$thumbnail_path = $destdir.$filename;
$image_file = $sourcefilepath;
$img = imagecreatefromjpeg($image_file);
$width = imagesx( $img );
$height = imagesy( $img );
// calculate thumbnail size
$new_width = $thumbWidth;
if($aspectratio==true)
{
$new_height = floor( $height * ( $thumbWidth / $width …Run Code Online (Sandbox Code Playgroud)