Skip to content

rillki/imgresize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imgresize

A fast command-line image resizing and conversion tool written in D.

Features

  • Resize images by dimensions (e.g., 512x512) or scale factor (e.g., 0.5)
  • Convert between formats: PNG, JPEG, BMP, TGA, GIF, QOI, QOIX, DDS, SQZ
  • Resizing using using stb_image_resize2
  • Alpha channel control - keep or remove transparency

Installation

Prerequisites

You need to install D compiler toolchain to build this project. Ensure you also have dub package manager installed on your system. It usually comes with the compiler, but sometimes you may need to install it separately on Linux.

Build from Source

# clone the repository
git clone https://github.com/rillki/imgresize.git
cd imgresize

# build the project
dub build --build=release

The executable will be saved in ./bin folder.

Usage

Usage: imgresize --path <file> --format <fmt> [--size <WxH> --output <file>]
-p         --path Required: Path to input image.
-f       --format Required: Output format (png, jpeg, bmp...).
-s         --size           Target size or ratio (e.g. 256x256 or 0.8). Defaults to original image size.
-o       --output           Output image path. Defaults to 'path'.
-r --remove-alpha           Remove alpha channel. Defaults to 'false'.
-h         --help           This help information.

Examples

Resize to specific dimensions:

imgresize --path photo.jpg --size 800x600 --format png

Resize relative to one of the dimensions:

imgresize --path photo.jpg --size 800x --format png

Scale by factor:

imgresize --path image.png --size 0.5 --format jpeg

Convert format without resizing:

imgresize --path photo.png --format jpeg --output photo.jpg

Remove transparency:

imgresize --path logo.png --remove-alpha --output logo-opaque.png

Quick resize with custom output:

imgresize -p original.jpg -s 1024x768 -f png -o thumbnail.png

Supported Formats

Input Formats

PNG, JPEG, JPEG XL, TGA, GIF, BMP, SQZ, QOI, QOIX, DDS

Output Formats

PNG, JPEG, TGA, GIF, BMP, SQZ, QOI, QOIX, DDS

Dependencies

For dependencies check out the dub.json file:

LICENSE

MIT.

About

Image resize and conversion utility.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages