mozilla / mozjpeg

Improved JPEG encoder.
Other
5.47k stars 415 forks source link

Compress image "jpg" with cjpeg command #364

Open hoa89nguyen opened 4 years ago

hoa89nguyen commented 4 years ago

Hi All, When i perform this command cjpeg -quality 90 /test.jpg >/test_output.jpg, I received the error: Unrecognized input file format --- perhaps you need -targa I see in usage.txt, we only support PPM, PGM, BMP,RLE. Do we have any workaround solution to reduce the image with JPG format?

Many thanks,

kornelski commented 4 years ago

You've used cjpeg command from libjpeg, rather than the cjpeg command from mozjpeg.

Compile mozjpeg, and potentially use relative paths like ./cjpeg or ./cjpeg-static instead of old system-wide cjpeg.

Or ideally, compile another tool like ImageMagick with MozJPEG instead of libjpeg, and don't use cjpeg at all.

I can also recommend using https://github.com/imazen/imageflow

zvezdochiot commented 4 years ago

@hoa89nguyen say:

Do we have any workaround solution to reduce the image with JPG format?

magicdawn commented 4 years ago
npm i handy-img -g

using sharp to decode img, and mozjpeg wasm version encode

image