# Compressing images from the CLI

### Steps

* Move all your image files to a folder
* calculate it's folder size using `du`
* create a copy of the folder.
* install imagemagick

`brew install imagemagick`

* in this folder, perform the following actions:

```bash
mkdir compressed
for i in *; do convert $i -resize 40% compressed/$i; done;
```

The above will compress all images by making the size 40% of the initial size and will move it to a folder called `compressed`

* Check folder structure again using `du`
* if it's still too much, repeat again but this time reduce quality to even lower


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.aldrinjenson.com/tools-and-workflow/compressing-images-from-the-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
