GD imagejpeg()压缩?

编程入门 行业动态 更新时间:2024-10-23 04:35:40
本文介绍了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).

我的问题是:

  • 我可以看到的唯一问题是 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()压缩?

    本文发布于:2023-11-01 02:20:55,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1547971.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:GD   imagejpeg

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!