Pass GD image object to Imagick?

霸气de小男生 提交于 2019-12-05 17:50:20

here we go:

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

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

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

ImageMagick has internal image creation functions. Using a barcode font you can directly create barcodes in ImageMagick. I guess ImageMagick will be more efficient in building images than PHP. Not sure about this (imageimagick's PDF functions are some times unexpected) but, as an additional bonus you may end up with vector output instead of bitmap, which will take more space and will not scale well.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!