php - GD 可以选择渐进式 JPEG 中的隔行扫描深度吗?

标签 php gd jpeg

我知道使用 imageinterlace可以创建渐进的图像,但我需要知道是否可以实际要求渐进的特定步骤。假设如果 Jpeg 文件是使用 3 级扫描创建的,我是否可以将其降级为仅 2 级或 1 级?

最佳答案

在构建 JPEG 时,这似乎不是您可以实际控制的事情。

来自Wikipedia's article on JPEG :

Baseline JPEG also supports progressive encoding. While sequential encoding encodes coefficients of a single block at a time (in a zigzag manner), progressive encoding encodes similar-positioned coefficients of all blocks in one go, followed by the next positioned coefficients of all blocks, and so on. So, if the image is divided into N 8×8 blocks {B0,B1,B2, ..., Bn-1}, then progressive encoding encodes Bi(0,0) for all blocks, i.e., for all i = 0, 1, 2, ..., N-1. This is followed by encoding Bi(0,1) coefficient of all blocks, followed by Bi(1,0)-th coefficient of all blocks, then Bi(2,0)-th coefficient of all blocks, and so on. It should be noted here that once all similar-positioned coefficients have been encoded, the next position to be encoded is the one occurring next in the zigzag traversal as indicated in the figure above.

根据描述,无法实际控制 JPEG 隔行扫描的性质。通过次数是标准和图像格式本身的一部分。

most other image formats 中同样无法控制。 ,其中大多数在其标准中也明确指出了一种且仅有一种交错公式,但 TGA 除外,它有两种。

关于php - GD 可以选择渐进式 JPEG 中的隔行扫描深度吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13890468/

相关文章:

python - 使用 PIL 处理截断的图像

ios - 来自 iOS 相机的图像在 Web 应用程序中旋转发送

image - 霍夫曼代码表

php - 从 PHP 到 MYSQL 的复选框到数组的简单代码有什么问题?

php - json_encode 从 MSSQL-SELECT 生成 JSON_ERROR_UTF8

PHP:使用 ImagePng 创建图像并在单个文件中使用 base64_encode 进行转换?

php - 用户名作为水印

php - SilverStripe SMTP 身份验证代替 PHP mail() 函数

php - Azure PHP SDK : download container's all blob in a single zip file

php - 让GD从二进制字符串中获取图像