1
├── ~/
│   ├── content/
│   │   ├── image01.jpg
│   │   ├── image02.png
│   │   ├── image03.bmp
│   │   ├── text-file.txt
│   │   ├── video.mp4
│   └── ...
└── ...

Let's say I want to compress all images in my content/ directory utilizing ImageMagick's standard -quality argument, with defualt settings. To overwrite and replace the files in their folder (caution!) it seems I would use the mogrify command:

~/content$ mogrify -quality *

but this just yields the following error:

@error /mogrify.c/MogrifyImageCommand/5730

What's the correct mogrify command? And what will happen to the non-image files (eg text-file.txt and video.mp4)? Perhaps I should request the individual mogrify commands for individual image types (eg jpg, png, bmp, etc.). Or is there a better strategy for salvaging non-image files?

Display name
  • 2,331

1 Answers1

0

Better compressed result for me is with optipng ref

Quoted as below

# install `$ sudo apt-get install -y optipng`
# see helpful syntax `$ tldr optipng`  # you may need install tldr `sudo apt-get install -y tldr`
optipng \       
    -o7         `# use best compression but quite slow ref. tldr optipng - fastest is w/ -o0` \
    -strip all  `# remove all metadata ref. tldr optipng` \
    *           `# all files or enter /path/to/your.png`
Nam G VU
  • 2,378