Recommendation for compressing JPG files with ImageMagick

后端 未结 10 1306
有刺的猬
有刺的猬 2020-12-04 04:10

I want to compress a JPG image file with ImageMagick but can\'t get much difference in size. By default the output size is bigger than the input. I don\'t know why, but afte

10条回答
  •  醉梦人生
    2020-12-04 04:58

    @JavisPerez -- Is there any way to compress that image to 150kb at least? Is that possible? What ImageMagick options can I use?

    See the following links where there is an option in ImageMagick to specify the desired output file size for writing to JPG files.

    http://www.imagemagick.org/Usage/formats/#jpg_write http://www.imagemagick.org/script/command-line-options.php#define

    -define jpeg:extent={size} As of IM v6.5.8-2 you can specify a maximum output filesize for the JPEG image. The size is specified with a suffix. For example "400kb".

    convert image.jpg -define jpeg:extent=150kb result.jpg
    

    You will lose some quality by decompressing and recompressing in addition to any loss due to lowering -quality value from the input.

提交回复
热议问题