aboutsummaryrefslogtreecommitdiff
path: root/content/snippets/batch-compress-images-magick.md
blob: e48439047af6603f8088726976f331826a157d09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
---
title: Batch compress image using ImageMagick
description: Batch compress image using ImageMagick
tags: ["commandline"]
---

This command loops a directory (`cd` into it, i'm assuming you're in it) and for every `.jpg` it aims to compress it to 200kb (not guaranteed)

```console
for file in *.jpg; do magick "$file" -define jpeg:extent=200kb "compressed/$file" done;
```

Make a `compressed` directory first, of course.