GD imagejpeg()压缩? [英] GD imagejpeg() compression?

查看:112
本文介绍了GD imagejpeg()压缩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个项目中,我编辑的jpg的PHP使用GD库的像素。
它的非常关键,并且我的项目的关键,PHP输出保留像素值我设置(cough-steganography-cough)。

I'm working on a project where I edit the pixels of a jpg in PHP using the GD library. Its very crucial and key to my project that the output from PHP retains the pixel values I set (cough-steganography-cough).

这是我第一次尝试在PHP中进行图像处理。我之前在我的Java实现没有问题,所以我很愚蠢的不调查GD的 jpeg 压缩质量,然后继续。

This is the first time I've attempted image manipulation in PHP. I've had no problems before in my Java implementations, so I was foolish not to investigate GD's jpeg compression quality before pursuing further.

事实证明,经过我所有的努力,我的代码不会按照它的方式运行。我很确定它不是我的代码(测试编辑和图像资源的编码和解码功能,他们工作)。

It turns out that after all my effort, my code does not function the way its supposed to. I am pretty sure it is not my code (tested the encode and decode functions on edited image resources and they worked).

我的问题是:


  1. 我可以看到的唯一问题是 imagejpeg()压缩。

是否有任何库提供我需要的压缩?(保留我更改的像素值)

Are there any libraries that provide the compression that I need?(retain pixel values that I changed)


推荐答案

如果您使用JPEG格式,那么 JPEG 隐身图片逐像素。

The JPEG file format is not very suitable for steganography if you do the steganography pixel by pixel.

JPEG 使用图像压缩 - 即使具有最高质量,也会破坏每个像素的位级别的信息。 jpeg压缩类型( 有损压缩 )是为人类眼睛/大脑保留图像,但不保留文件中图像的位。

JPEG uses an image compression - that even with maximum quality - that will destroy the information on the bit level on each pixel. The jpeg type of compression (lossy compression) is made for the human eye/brain to retain the image but not the bits of the image in the file .

您需要使用能够保留像素的图像格式写了它已经一样好。这种格式更有可能是具有 RLE 压缩的 BMP 或具有 ZIP RLE的 TIFF 压缩。这称为 无损数据压缩

You need to use an image format that is capable to retain the pixels - as you wrote it already as well. Such a format more likely is BMP with RLE compression or the TIFF image format with ZIP or RLE compression. That's called lossless data compression.

这篇关于GD imagejpeg()压缩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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