相关疑难解决方法(0)

ImageMagick vs GD - 更快,资源更少,产生更好的图像?

我需要在ImageMagick或GD库之间进行选择,以执行以下图像处理任务:

  • 将图像调整为多种尺寸
  • 水印图像

如你所见,我不需要任何花哨的东西.我确信这两个工具都可以实现它们,所以如果一个人有比另一个更多的额外功能,我真的不在乎.

我主要关心的是性能和质量.这两种工具中哪一种消耗的资源更少,速度更快,产生更高质量的图像?

PS我需要将它与各自的PHP API一起使用.

php gd imagemagick image-processing

34
推荐指数
3
解决办法
4万
查看次数

PHP中的图像调整大小问题 - gd会创建丑陋的调整大小的图像

我使用以下函数从我的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)

php image thumbnails

7
推荐指数
1
解决办法
9126
查看次数

标签 统计

php ×2

gd ×1

image ×1

image-processing ×1

imagemagick ×1

thumbnails ×1