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

https://github.com/2kabhishek/pgm-resize

For your PGM resizng needs 🖼⚒️
https://github.com/2kabhishek/pgm-resize

c cli image-processing pgm resize tool

Last synced: 25 days ago
JSON representation

For your PGM resizng needs 🖼⚒️

Awesome Lists containing this project

README

          

PGM-Resize


License


People


Stars


Forks


Watches


Last Updated

For your PGM resizng needs 🖼⚒️

## What is this

pgm-resize is a tool that allows you to quickly resize [.pgm](http://davis.lbl.gov/Manuals/NETPBM/doc/pgm.html) images.

## Inspiration

Needed a thumbnail generator for PGM(P2 type) images, all available tools were resizing it to P5 type, then decided to make this.

## Prerequisites

Before you begin, ensure you have met the following requirements:

- You have installed the latest version of `gcc`

## Getting pgm-resize

To get pgm-resize, follow these steps:

```bash
git clone https://github.com/2kabhishek/pgm-resize
cd pgm-resize
make
```

## Using pgm-resize

```bash
USAGE:
pgm-resize path/to/image.pgm [WIDTH]

OPTIONS:
WIDTH - Provide a custom output image width
Height is proportionately adjusted
(Halves original image width by default)

OUTPUT:
The resized image will be placed in he same path
as the original image with a '-resize' added

Example:

./pgm-resize images/apollonian.pgm 240
# output: images/apollonian-resize.pgm with 240 width
./pgm-resize images/venus.pgm
# output: images/venus-resizw.pgm with width halved
```

For alternate implementation with pipe operations, see [alt branch](https://github.com/2kabhishek/pgm-resize/tree/alt).

## How it was built

pgm-resize was built using `neovim`, 'gcc', 'make'

## Challenges faced

Faced some segfaults, `gcc -g` and `gdb` came to rescue

## What I learned

- Learned about the `.pgm` image format
- Worked with file IO in c
- Did some math tricks for resizing the images
(Used mean to combine multiple pixels into one)

Hit the ⭐ button if you found this useful.

## More Info

Source | Website