2

有没有办法在 bash 中填充或“解压缩”图像(JPEG)?我的意思是,例如,如果图像大小为 1.5MB,我希望它填充到 5MB。图像的最终质量并不(那么)重要。如果此填充在图像旁边留下一个黑色矩形,则它是可以接受的。

编辑:下面的唯一答案正确猜测这是一个 XY 问题。

4

1 回答 1

2

A quick experiment indicates that just appending zero bytes to a *.jpg image file still allows it to be viewed.

On Unix, I used a command like this:

( cat original.jpg ; dd if=/dev/zero bs=1024 count=1024 ) > bigger.jpg

I suspect that any arbitrary data, not just zeros, would have the same result.

(Using an image editor to append a black rectangle to an image probably wouldn't increase the file size by much; compression works really well on blocks of solid color.)

I can hardly imagine a good reason to do this, though.

Update :

Based on your comment, this answers the question you asked, but almost certainly won't address your actual problem. You haven't given us enough information to guess how to do that.

This is a classic XY problem.

于 2012-07-10T02:50:56.973 回答