<commit_before>## ImageMagick

<!-- MarkdownTOC -->

- [Supported delegates and formats](#supported-delegates-and-formats)
- [Convert between formats](#convert-between-formats)
    - [PNG to JPG](#png-to-jpg)
    - [PNG to ICO](#png-to-ico)
- [Resize an image](#resize-an-image)
- [Crop left side an image](#crop-left-side-an-image)

<!-- /MarkdownTOC -->

<https://imagemagick.org/>

### Supported delegates and formats

``` sh
$ magick -version
Version: ImageMagick 7.0.9-8 Q16 x86_64 2019-12-09 https://imagemagick.org
Features: Cipher DPC HDRI Modules OpenMP(3.1)
Delegates (built-in): bzlib freetype heic jng jp2 jpeg lcms ltdl lzma openexr png tiff webp xml zlib
```

``` sh
$ magick identify -list format
```

### Convert between formats

#### PNG to JPG

``` sh
$ magick convert -quality 90% ./some.png ./some.jpg
```

#### PNG to ICO

``` sh
$ magick image.png -background none -resize 256x256 -density 256x256 icon.ico
```

### Resize an image

Resize an image to a specific width (`100 px`) while preserving the aspect:

```
$ magick convert image.jpg -resize 100 image-resized.jpg
```

Resize all images in the current folder and append the `-thumb` suffix to files names:
<commit_msg>ImageMagick: Several sizes in one ICO<commit_after>## ImageMagick

<!-- MarkdownTOC -->

- [Supported delegates and formats](#supported-delegates-and-formats)
- [Convert between formats](#convert-between-formats)
    - [PNG to JPG](#png-to-jpg)
    - [PNG to ICO](#png-to-ico)
- [Resize an image](#resize-an-image)
- [Crop left side an image](#crop-left-side-an-image)

<!-- /MarkdownTOC -->

<https://imagemagick.org/>

### Supported delegates and formats

``` sh
$ magick -version
Version: ImageMagick 7.0.9-8 Q16 x86_64 2019-12-09 https://imagemagick.org
Features: Cipher DPC HDRI Modules OpenMP(3.1)
Delegates (built-in): bzlib freetype heic jng jp2 jpeg lcms ltdl lzma openexr png tiff webp xml zlib
```

``` sh
$ magick identify -list format
```

### Convert between formats

#### PNG to JPG

``` sh
$ magick convert -quality 90% ./some.png ./some.jpg
```

#### PNG to ICO

Simple case:

``` sh
$ magick image.png -background none -resize 256x256 -density 256x256 icon.ico
```

Several sizes in one:

``` sh
$ magick image.png -background none -resize 256x256 -define icon:auto-resize="256,128,96,64,48,32,16" icon.ico
```

### Resize an image

Resize an image to a specific width (`100 px`) while preserving the aspect:

```
$ magick convert image.jpg -resize 100 image-resized.jpg
```

Resize all images in the current folder and append the `-thumb` suffix to files names:

{'fraction_non_alphanumeric': 0.1466252909231963, 'fraction_numerical': 0.04034134988363072, 'mean_word_length': 3.8660377358490567, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3797982', 'n_tokens_mistral': 1006, 'n_tokens_neox': 888, 'n_words': 283}