压缩图像使其小于4KB [英] Compressing an image to make it less than 4KB

查看:194
本文介绍了压缩图像使其小于4KB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个人的图像,我想对其进行压缩以使其小于4KB。我需要压缩它,并且即使图像缩小也仍然可以识别人的脸。

I have an image of a person and I want to compress it to make it less than 4KB. I need to compress it and still have the face of the person recognizable even if the image will shrink.

推荐答案

这是Theresa May在142kB:

Here is Theresa May at 142kB:

并调整为72x72,在命令行中使用 ImageMagick 将其转换为灰度并缩小为2kB:

and resized to 72x72 and converted to greyscale and reduced to 2kB with ImageMagick at the command line:

convert original.jpg -resize 72x72 -colorspace gray -define jpeg:extent=2kb result.jpg

我仍然可以认出她。

这里有些其他人减少到1kB,我仍然可以认出他:

Here is some other guy reduced to 1kB and I can still recognise him too:

ImageMagick 是安装在大多数Linux发行版上,可用于macOS和Windows。绑定适用于Python,PHP,Ruby,Javascript,Perl等。

ImageMagick is installed on most Linux distros and is available for macOS and Windows. Bindings are available for Python, PHP, Ruby, Javascript, Perl etc.

如果您对图片有进一步的了解,或您的识别算法,您也许可以做得更好。例如,如果您知道图像的中心比边缘更重要,则可以在相对不重要的区域稍微模糊或降低对比度,并在重要区域中使用可用空间获取更多细节。

If you had further knowledge about your images, or your recognition algorithm, you may be able to do better. For example, if you knew that the centre of the image was more important than the edges, you could slightly blur, or reduce contrast in relatively unimportant areas and use the available space for more details in the important areas.

这篇关于压缩图像使其小于4KB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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