2011-08-17 67 views
1

我需要知道是否有任何可用的PHP方法,通过它我可以在300ppi中创建图像?我看到GD库的文档,但找不到任何信息。有没有什么方法可以处理图像并设置ppi?如何在php中创建300ppi图片?

或者,有什么方法可以在Flash中转换图像分辨率?

感谢

玛尼

+2

好像调整大小是你在GD唯一的选择。看看这个在PHP.net上的评论。 Imagick的PHP可能是要走的路:http://www.php.net/manual/en/function.imagick-setresolution.php#95533 –

回答

2

这里的样本代码,你可以使用:

imagejpeg($image, $file, 75); 

// Change DPI 
$dpi_x = 300; 
$dpi_y = 300; 

$image = file_get_contents($file); 

// Update DPI information in the JPG header 
$image[13] = chr(1); 
$image[14] = chr(floor($dpi_x/255)); 
$image[15] = chr($dpi_x%255); 
$image[16] = chr(floor($dpi_y/255)); 
$image[17] = chr($dpi_y%255); 

// Write the new JPG 
file_put_contents($file, $msg); 
+0

感谢您的答案,我会尝试它。我不会忘记接受答案,那么它的工作:) –