An open API service indexing awesome lists of open source software.

https://github.com/sunjay-dev/image-format-converter

A CLI tool to convert images formats with features like quality control, batch mode, and more.
https://github.com/sunjay-dev/image-format-converter

Last synced: 7 months ago
JSON representation

A CLI tool to convert images formats with features like quality control, batch mode, and more.

Awesome Lists containing this project

README

          

# ๐Ÿ–ผ๏ธ Imgify - Image Format Converter

SolarVerse Preview

A simple and powerful CLI tool to **convert images** to different formats like WebP, JPEG, PNG, AVIF, and more โ€” powered by [Sharp](https://github.com/lovell/sharp).

---

## ๐Ÿš€ Features
- โœ… Convert a single image or **batch convert all** in a folder
- ๐ŸŽฏ Format support: `webp`, `jpeg`, `png`, `avif`, `tiff`, `gif`
- ๐ŸŽš๏ธ Control output quality (`-quality=80`)
- ๐Ÿ” Filter files by extension (`-ext=jpg`)
- ๐Ÿ—‘๏ธ Delete original files after conversion (`-del`)
* ๐Ÿงช **preview run** support โ€” see what will be converted (`-preview`)

---

### ๐Ÿ“ฆ Installation & Usage

### ๐Ÿš€ One-liner (No install needed):

```bash
npx imgify-cli input.png output.jpeg
```

You can use all options like:

```bash
npx imgify-cli -all -ext=png -f=webp -quality=80
```

This is the **recommended way** to use `imgify-cli` quickly and without setup.

---

### ๐Ÿ’ป Local Development or Manual Global Setup (For Offline Use or Contribution)

#### ๐Ÿ”ง Manual setup (if you want to contribute or link locally):

1. Clone the repo: (Open Terminal as **Administrator**)

```bash
git clone https://github.com/sunjay-dev/Image-Format-Converter
```

2. Enter the directory:

```bash
cd Image-Format-Converter
```

3. Install dependencies:

```bash
npm install
```

4. Link globally:

```bash
npm link
```

> Now you can run `imgify` anywhere.

---

## ๐Ÿง‘โ€๐Ÿ’ป Usage

### โžค Convert a single image

```bash
imgify input.jpg output.png
```

### โžค Convert with a custom output

```bash
imgify input.jpg output.webp
```

### โžค Convert all images in the current folder

```bash
imgify -all
```

### โžค Convert only `.png` images

```bash
imgify -all -ext=png
```

### โžค Convert and delete original files

```bash
imgify -all -del
```

### โžค Preview conversion (preview run)

```bash
imgify -all --preview
```

---

## ๐Ÿ”ง Options

| Flag | Description | Default |
| -------------- | ------------------------------------------------------------ | ------- |
| `-all` | Convert all `.jpg`, `.jpeg`, `.png` in current folder | โ€” |
| `-quality=80` | Output quality (0โ€“100, lossy formats only) | `80` |
| `-format=webp` | Output format: `webp`, `jpeg`, `png`, `avif`, `tiff` | `webp` |
| `-ext=png` | Only convert files with the specified extension | all |
| `-del` | Delete the original file(s) after conversion | off |
| `-preview` | Simulate conversion (log what would be converted) | off |
| `-help` | Show usage instructions | โ€” |

---

## ๐Ÿงช Examples

```bash
imgify input.jpg -format=avif -quality=70
imgify -all -ext=jpeg -format=png -del
imgify input.png output.avif -quality=90
imgify -all -preview
```

---

## ๐Ÿ“‚ Supported Formats

* **Input**: `.jpg`, `.jpeg`, `.png`, `.webp`, `.tiff`, `.gif`, `.avif`
* **Output**: `webp`, `jpeg`, `png`, `avif`, `tiff`

> Internally uses [Sharp](https://www.npmjs.com/package/sharp) for fast, high-quality conversions.