将GD图像对象传递给Imagick? [英] Pass GD image object to Imagick?

查看:107
本文介绍了将GD图像对象传递给Imagick?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用使用GD的PEAR :: Image_Barcode生成条形码,但是我需要将该条形码写到PDF的一部分上,PHP/Imagick似乎是最简单的方法,有什么方法可以将GD图像对象转换为Imagick可以使用的对象?

I'm generating a barcode with PEAR::Image_Barcode which uses GD, but I need to write that barcode onto a section of a PDF and PHP/Imagick seems to be the easiest way to do that, is there any way to convert a GD image object into something Imagick can work with?

推荐答案

我们去了

ob_start();
 Image_Barcode::draw($barcode, 'upca', 'gif');
 $couponBarcode = ob_get_contents();
ob_end_clean();

$second = new Imagick(); 
$second->readImageBlob($couponBarcode)

它将图像写入具有GD的输出缓冲区,然后将该变量读取到Imagick中对象

it's writing the image to an output buffer with GD then reading that variable into an Imagick object

这篇关于将GD图像对象传递给Imagick?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆