Skip to content

molecula451/png2jpeg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PNG to JPEG Converter

png2jpeg

A fast, modern C++17 PNG to JPEG converter with zero external dependencies.

Features

  • 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)

Building

Requirements

  • CMake 3.10 or higher
  • Only g++ tested

Compile

# 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 install

Windows (Visual Studio)

mkdir build && cd build
cmake ..
cmake --build . --config Release

Usage

# 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

Options

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

Examples

# 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

Limitations

  • Only supports 8-bit depth PNG images
  • Interlaced PNGs are not supported
  • Alpha channel is ignored during conversion

License

See LICENSE for details.

About

Simple PNG to JPEG NO External Dependencies

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published