A fast, modern C++17 PNG to JPEG converter with zero external dependencies.
- Pure C++17 implementation
- No external libraries required (no libpng, libjpeg, etc.)
- Supports 8-bit PNG images (grayscale, RGB, RGBA)
- Adjustable JPEG quality (1-100)
- Cross-platform (Linux, macOS, Windows)
- CMake 3.10 or higher
- Only g++ tested
# Clone the repository
git clone https://github.com/molecula451/png2jpeg.git
cd png2jpeg
# Create build directory
mkdir build && cd build
# Configure and build
cmake ..
make
# (Optional) Install
sudo make installmkdir build && cd build
cmake ..
cmake --build . --config Release# Basic usage (output will be input.jpg)
./png2jpg input.png
# Specify output filename
./png2jpg input.png output.jpg
# Set JPEG quality (1-100, default: 85)
./png2jpg -q 90 input.png
# Verbose output
./png2jpg -v input.png output.jpg
# Show help
./png2jpg --help
# Show version
./png2jpg --version| Option | Description |
|---|---|
-q, --quality <1-100> |
Set JPEG quality (default: 85) |
-v, --verbose |
Enable verbose output |
-h, --help |
Show help message |
--version |
Show version information |
# Convert with default quality (85)
./png2jpg photo.png
# High quality conversion
./png2jpg -q 95 photo.png photo_hq.jpg
# Lower quality for smaller file size
./png2jpg --quality 60 --verbose screenshot.png compressed.jpg- Only supports 8-bit depth PNG images
- Interlaced PNGs are not supported
- Alpha channel is ignored during conversion
See LICENSE for details.