图像处理&在PHP中创建 - 如何创建300DPI图像 [英] Image Processing & Creation in PHP - How To Create 300DPI Images

查看:1166
本文介绍了图像处理&在PHP中创建 - 如何创建300DPI图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP中使用GD库创建图像时ie) imagecreatetruecolor()生成图像的DPI是多少?我无法找到任何人指定dpi可以设置的位置或默认值。

When creating images using the GD library in PHP ie) imagecreatetruecolor() what is the DPI of the resulting image? I haven't been able to find anyone specifying where the dpi can be set or what it defaults to.

我需要创建300DPI tiff或jpeg,然后从程序中保存到文件系统。

I require a 300DPI tiff or jpeg to be created and then saved to the file system from the program.

如果使用GD库无法做到这一点,那还有另一种适用于这种情况吗?

If this isn't possible using the GD library, is there another that would work for this situation?

感谢您的帮助

编辑:是的,这是创建图像 - 我想有300dpi从脚本保存的文件不必打开photoshop中的每个文件来指定dpi。

Yes this is creating an image - I would like to have a 300dpi file saved from the script not have to open up each file in photoshop to specify the dpi.

推荐答案

我认为没有用GD设置DPI的方法。图像的DPI在图像数据的前导字节中指定 - 我相信JPEG图像的字节为15-18。字节15-16是水平DPI,垂直17-18。这些值存储为八进制。

I don't think there's a way of setting DPI with GD. The DPI of an image is specified in the leading bytes of the image data - I believe for JPEG images that's bytes 15-18. Bytes 15-16 are horizontal DPI, 17-18 vertical. The values are stored as octals.

我对字节级编辑有点啰嗦,但您可以将GD中的图像调整为目标像素大小,然后编辑用于调整DPI的文件。

I'm a bit ropey with byte-level editing, but you could resize the image in GD to the target pixel size and then edit the file to adjust the DPI.

这篇关于图像处理&在PHP中创建 - 如何创建300DPI图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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