https://github.com/helias/png-reindexing
PNG reindexing, Multimedia university project
https://github.com/helias/png-reindexing
ant-colony antcolony palette palette-generation palette-software png png-compression png-optimization pypng python3
Last synced: 3 months ago
JSON representation
PNG reindexing, Multimedia university project
- Host: GitHub
- URL: https://github.com/helias/png-reindexing
- Owner: Helias
- License: agpl-3.0
- Created: 2019-04-07T15:22:17.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-23T10:15:56.000Z (almost 6 years ago)
- Last Synced: 2025-01-03T14:17:44.905Z (5 months ago)
- Topics: ant-colony, antcolony, palette, palette-generation, palette-software, png, png-compression, png-optimization, pypng, python3
- Language: Python
- Size: 78.1 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PNG-reindexing
PNG reindexing a university project for the course Multimedia.This project consist into implement this concept: *[A Fast Palette Reordering Technique Based on GPU-Optimized Genetic Algorithms](https://ieeexplore.ieee.org/document/8451221/authors#authors)*
This project use AntColony algorithm based on [this](https://github.com/trevlovett/Python-Ant-Colony-TSP-Solver) implementation.
You can try this project with the Telegram Bot [PNG-reindexer-bot](https://github.com/Helias/PNG-reindexer-bot), just open [@png_reindexer_bot](https://t.me/png_reindexer_bot) with Telegram and send a picture.
## Requirements
To run this project you need **Python3** and the following packages:
- pypng
- numpy
- scipy
- imageYou can install the packages dependencies through:
```
$ pip3 install -r requirements.txt
```Use just "pip" if you have python3 as default instead of python2.
## Usage
This project provides the following commands:
```
$ python3 main.py -r
```The `-r` (run) parameter generate a new image img1.png of 8x8 pixels with random palette and colors and img2.png with a ordered palette.
```
$ python3 main.py -i path/file_name.png
```The `-i` (input) parameter get a png image as input and generate the same image as img2.png with a new palette ordered and with the reindexed colors.
If the picture has more than 256 colors, it can't create a palette following the PNG standard, so, optionally it can reduce the colors of the image to 256 with the parameter `-f` (force).
```
$ python3 main.py -i path/file_name.png -f
```---
The `-l` (log) parameter is optional, if used it generates a file `palette_stats.txt` that show the pixels indexed, palette and the best order of palette (about old unordered palette and new image with ordered palette).
Is recommended to use this parameter only with small images.## Credits
- [Helias (Stefano Borzì)](https://github.com/Helias)