使用phpimageworkshop以300 dpi保存图像

时间:2015-08-11 06:09:52

标签: php image image-processing printing

您好我正在一个屏幕上打印应用程序,前端javascript定制器将发送然后通过ajax将xml数据发送到我的服务器。 我正在使用phpimageworkshop

生成最终的自定义图像,一切都运行良好,除了最终输出文件,即使最初上传的图像是300 DPI,也会在72 DPI中输出。为了我的目的,我需要打印准备好300 DPI的最终输出,这是生成的简单代码。

<?php
use PHPImageWorkshop\ImageWorkshop; // Use the namespace of ImageWorkshop
require_once('PHPImageWorkshop/ImageWorkshop.php'); // Be sure of the path to the class
$pinguLayer = ImageWorkshop::initFromPath(__DIR__.'/images/cards-01.jpg');
echo $pinguLayer->getWidth();
echo $pinguLayer->getHeight();
//$pinguLayer->resizeInPixel(400, null, true);

$wwfLogoLayer = ImageWorkshop::initFromPath(__DIR__.'/images/wwf.png');
$tuxLayer = ImageWorkshop::initFromPath(__DIR__.'/images/tux.png');

/*$wwfLogoLayer->resizeInPixel(64, 64, true);
$tuxLayer->resizeInPixel(64, 64, true);
*/
$pinguLayer->addLayerOnTop($wwfLogoLayer, 20, 10, 'LB');
$pinguLayer->addLayerOnTop($tuxLayer, 20, 10, 'RT');

$dirPath = __DIR__."/exports/";
$filename = "pingu_edited.jpg";
$createFolders = true;
$backgroundColor = null; // transparent, only for PNG (otherwise it will be white if set null)
$imageQuality = 100; // useless for GIF, usefull for PNG and JPEG (0 to 100%)

$pinguLayer->save($dirPath, $filename, $createFolders, $backgroundColor, $imageQuality);
?>

无论如何在300 DPI中指定输出?

0 个答案:

没有答案