【问题标题】:How to create 300ppi image in php?如何在 php 中创建 300ppi 图像?
【发布时间】:2011-10-29 03:04:21
【问题描述】:

我想知道 PHP 中是否有任何可用的方法可以通过它创建 300ppi 的图像?我看到了 GD 库的文档,但找不到任何信息。有什么方法可以处理图像和设置ppi吗?

或者,闪存中是否有任何方法可以转换图像分辨率?

谢谢

玛尼

【问题讨论】:

标签: php flash image-processing gdlib


【解决方案1】:

这里有一个您可以使用的示例代码:

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);

【讨论】:

  • 谢谢你的回答,我试试。我不会忘记接受答案然后它会起作用:)
猜你喜欢
  • 2011-08-17
  • 2014-10-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多