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 🖼⚒️
- Host: GitHub
- URL: https://github.com/2kabhishek/pgm-resize
- Owner: 2KAbhishek
- License: gpl-3.0
- Created: 2022-07-06T13:31:37.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-16T07:36:23.000Z (over 3 years ago)
- Last Synced: 2025-03-01T12:48:16.164Z (over 1 year ago)
- Topics: c, cli, image-processing, pgm, resize, tool
- Language: C
- Size: 114 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 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