【问题标题】:Change the quality of the image (without changing the resolution)改变图像质量(不改变分辨率)
【发布时间】:2012-10-27 18:09:04
【问题描述】:

我找到了这个命令

调整图像大小以提高质量:

$ convert input.png -colorspace RGB +sigmoidal-contrast 11.6933 \ 
-define filter:filter=Sinc -define filter:window=Jinc -define filter:lobes=3 \ 
-resize 400% -sigmoidal-contrast 11.6933 -colorspace sRGB output.png

但我需要别的东西,我需要一个命令来降低图像质量。 例如,如果 input.png 是 100pix x 100pix 分辨率和 100KB 大小 我想制作一个具有相同分辨率但质量较低的 output.png 图像,比如说 50KB

我该怎么做?

(我最初的问题是限制为 50KB 的图像,我想做的就是将我所有的图像转换为 50KB 以下的大小)。

我希望这很容易解决,但我自己无法解决。

谢谢

【问题讨论】:

  • 你试过pngcrush吗?它不会改变图像的质量,但会尝试压缩它。如果您尝试减小 文件大小,则质量不一定会因 PNG 类型的压缩而改变。除非你试图减少整体颜色的数量并索引调色板......这可能会奏效。
  • 我不知道该怎么办:),我知道可以降低图像质量并减小图像尺寸,但我不知道如何使用 shell 来做到这一点跨度>
  • 你可以试试 convert 的 -depth 参数。我发现convert file.png -depth 4 将我的 PNG 文件大小减少了大约 50%。
  • 对于 pngcrush,我通常使用pngcrush -rem alla -brute -reduce input.png output.png。它因文件而异,但您可以获得一些严重的减少。 -bit_depth 4 可以让你获得更多,类似于 -depth 4 的转换,但你会失去某些图像的实际质量。
  • 这个问题与 Android 有什么关系?

标签: android linux image bash imagemagick


【解决方案1】:

只需将图像转换为较低的采样率。 ImageMagick 在Transformations 上有一篇文章,涵盖了一些选项。

convert input.png -sample 25% -scale 400% output.png

结果:

input.png  PNG 640x480 640x480+0+0 8-bit sRGB 256c 27.4KB 0.000u 0:00.000
output.png PNG 640x480 640x480+0+0 8-bit sRGB 225c 6.58KB 0.000u 0:00.000

input.png

output.png

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-19
    • 2012-07-01
    • 2016-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多