Rate-Distortion Optimized Lossy PNG Encoding Tool

Overview

rdopng

Rate-Distortion Optimized Lossy PNG Encoding Tool

rdopng is a command line tool which uses LZ match optimization, Lagrangian multiplier rate distortion optimization (RDO), a simple perceptual error tolerance model, and Oklab-based colorspace error metrics to encode 24/32bpp PNG files which are 30-80% smaller relative to lodepng/libpng. The tool defaults to reasonably fast near-lossless settings which writes PNG's around 30-40% smaller than lossless PNG encoders.

Unlike pngquant, rdopng does not use 256-color palettes or dithering. PNG files encoded by rdopng typically range between roughly 2.5-7bpp, depending on the options used (and how much time and patience you have).

Some example encodes and command lines are here.

You can download a pre-built Windows binary here. You may need to install the VS 2022 runtime redistributable from Microsoft.

Building

You'll need cmake. There are no other dependencies.

Linux (gcc/clang):

cmake .
make

Windows (tested with Visual Studio 2022):

cmake .
rdopng.sln

Instructions

Encodes a .PNG/.BMP/.TGA/.JPG file to "./file_rdo.png":

rdopng file.png

Encodes smaller files but will be 2x slower:

rdopng -two_pass file.png

Encodes at lower than default quality (which is 300), but writes smaller files:

rdopng -lambda 500 file.png

Significantly lower quality (which increases artifacts), using a higher than default parsing level to compensate for artifacts:

rdopng -level 3 -lambda 1000 file.png

Enable debug output and write output to z.png:

rdopng -debug file.png -output z.png

Level ranges from 0-29. Levels 0-9 use up to 4 pixel long matches, levels 10-17 use up to 6 pixel long matches, and 18-23 use up to 6 or 12 pixel long matches. Levels 24-29 use exhaustive matching and are beyond impractical except on tiny images.

The higher the level within a match length category, the slower the encoder. Higher match length categories are needed for the higher lambdas/lower bitrates. At near-lossless settings (lower than approximately lambda 300), the smaller/less aggressive parsing levels are usually fine. At higher lambdas/lower bitrates the higher levels are needed to avoid artifacts. To get below roughly 3-4bpp you'll need to use high lambdas, two pass mode, and very slow parsing levels.

-lambda is the quality slider. Useful lambda values are roughly 1-20000, but values beyond approximately 500-1000 (depending on the image) will require fiddling with the level to compensate for artifacts. Higher levels are extremely slow because the current tool is single threaded.

You might also like...
An 'embedded-friendly' (aka Arduino) JPEG image encoding library

Starting in the late 80's I wrote my own imaging codecs for the existing standards (CCITT G3/G4 was the first). I soon added GIF, JPEG and not long after that, the PNG specification was ratified. All of this code was "clean room" - written just from the specification. I used my imaging library in many projects and products over the years and recently decided that some of my codecs could get a new lease on life as open source, embedded-friendly libraries for microcontrollers.

Monster Mash: New Sketch-Based Modeling and Animation Tool

Monster Mash is a new sketch-based modeling and animation tool that allows you to quickly sketch a character, inflate it into 3D, and promptly animate it. You can perform all interactions in the sketching plane. No 3D manipulation is required.

Spotfetch - a tool to fetch spotify info with with ascii picture written in C++
Spotfetch - a tool to fetch spotify info with with ascii picture written in C++

A C++ fetch tool for spotify, its a cool little tool to retrieve information on current playing song on spotify. Run the command and be treated to a pixelated version of the album art accompanied by its information.

A tool for drawing 2d diagrams, 3d knots, Seifert surfaces. Computes some knot properties and invariants.
A tool for drawing 2d diagrams, 3d knots, Seifert surfaces. Computes some knot properties and invariants.

A tool for drawing 2d diagrams, 3d knots, Seifert surfaces. Computes some knot properties and invariants.

3D Procedural Terrain Generation and Texturing Tool in OpenGL/C++
3D Procedural Terrain Generation and Texturing Tool in OpenGL/C++

TerraForge3D 3D Procedural Terrain Generation Tool in OpenGL/C++ Give your valuable feedback : https://github.com/Jaysmito101/TerraForge3D/discussions

Lossy fixed-rate GPU-friendly image compression\decompression.
Lossy fixed-rate GPU-friendly image compression\decompression.

NotOkImageFormat Lossy fixed-rate GPU-friendly image compression\decompression. Supported profiles 16:1:1 2.8125 bpp yuv 4:1:1 3.75 bpp

BYOD is a guitar distortion plugin with a customisable signal chain that allows users to create their own guitar distortion effects.

BYOD is a guitar distortion plugin with a customisable signal chain that allows users to create their own guitar distortion effects. The plugin contains a wide variety of distortion effects from analog modelled circuits to purely digital creations, along with some musical tone-shaping filters, and a handful of other useful processing blocks.

Analysing and implementation of lossless data compression techniques like Huffman encoding and LZW was conducted along with JPEG lossy compression technique based on discrete cosine transform (DCT) for Image compression.

PROJECT FILE COMPRESSION ALGORITHMS - Huffman compression LZW compression DCT Aim of the project - Implement above mentioned compression algorithms an

COBS framing with implicit run-length-encoding, optimized for data containing statistically a bit more 0 and FF bytes in a row, as data often carry 16, 32 or 64 bit numbers with small values.

TCOBS Table of Contents About The project TCOBS Specification TCOBS code Getting Started 4.1. Prerequisites 4.2. Installation 4.3. Usage in Go 4.3.1.

A simple fisheye distortion correction program
A simple fisheye distortion correction program

Correct Fisheye Distortion of the first Chinese Mars Image 热烈祝贺中国首次火星探测天问一号任务探测器发回火星照片 Requirements A C++ compiler OpenCV How to compile cmake . make

A weird distortion and lowpass plugin

Delta Limiter Building ./waf clean configure build Documentation pandoc -s user_manual.md -o user_manual.html pandoc -s user_manual.md -o user_manual.

Overdrive/Distortion simulation
Overdrive/Distortion simulation

CollisionDrive.lv2 Overdrive/Distortion Features Overdrive/Distortion simulation. Dependencys libcairo2-dev libx11-dev Build git submodule init git su

Flutter real-time magnifying glass lens widget with Barrel/Pincushion distortion
Flutter real-time magnifying glass lens widget with Barrel/Pincushion distortion

MagnifyingGlass Flutter plugin Flutter real-time magnifying glass lens widget with Barrel/Pincushion distortion. Works on Android, iOS and desktop. Do

Lidar-with-velocity - Lidar with Velocity: Motion Distortion Correction of Point Clouds from Oscillating Scanning Lidars
Lidar-with-velocity - Lidar with Velocity: Motion Distortion Correction of Point Clouds from Oscillating Scanning Lidars

Lidar with Velocity A robust camera and Lidar fusion based velocity estimator to undistort the pointcloud. This repository is a barebones implementati

Icopack - A simple command line tool to create multi-frame ICO files from PNG source images
Icopack - A simple command line tool to create multi-frame ICO files from PNG source images

Optidash is a modern, AI-powered image optimization and processing API. We will drastically speed-up your websites and save you money on bandwidth and

Heart Rate Monitor for FPV drones
Heart Rate Monitor for FPV drones

Heart Rate Monitor for FPV drones Watch your heart rate on Betaflight OSD 💓 See how excited you are while: Diving the highest skyscraper 🏙 Flying lo

Faster Non-Integer Sample Rate Conversion
Faster Non-Integer Sample Rate Conversion

Non-Integer Sample Rate Conversion This repository contains a comparison of sample-rate conversion (SRC) algorithms, with an emphasis on performance f

Comments
  • cli help states -normal option, not -normal_map

    cli help states -normal option, not -normal_map

    Hi! I'm taking my first steps with your tool. The help shows a normal map mode:

    -normal: Normal map mode (linear metrics, print normal map statistics, angular error and rejection metrics)

    But when I add it as an option, I get an error: Unrecognized command line option: -normal

    Using the 1.09 binary release on Win10.

    opened by OlafHaag 1
Releases(1.0.9)
Owner
Rich Geldreich
Rich Geldreich
Arduino PNG image decoder library

An 'embedded-friendly' (aka Arduino) PNG image decoding library

Larry Bank 102 Jan 6, 2023
pngtostl is a program that converts a PNG image into STL 3D models

pngtostl is a program that converts a PNG image into a litophane, in STL format, suitable to be printed by entry level 3D printers.

Salvatore Sanfilippo 157 Dec 17, 2022
libspng is a C library for reading and writing PNG format files with a focus on security and ease of use.

libspng (simple png) is a C library for reading and writing Portable Network Graphics (PNG) format files with a focus on security and ease of use.

Randy 570 Dec 29, 2022
Simple, generally spec-compliant, hacky PNG Decoder written in C99.

Simple, generally spec-compliant, hacky PNG Decoder written in C99.

cristei 2 Nov 2, 2021
Very fast C++ .PNG writer for 24/32bpp images.

fpng Very fast C++ .PNG writer for 24/32bpp images. fpng.cpp was written to see just how fast you can write .PNG's without sacrificing too much compre

Rich Geldreich 639 Dec 25, 2022
Demo of a fast PNG encoder.

Fast PNG Encoder This is a proof-of-concept fast PNG encoder that uses AVX2 and a special Huffman table to encode images faster. Speed on a single cor

Luca Versari 58 Dec 27, 2022
An image and texture viewer for tga, png, apng, exr, dds, gif, hdr, jpg, tif, ico, webp, and bmp files

An image and texture viewer for tga, png, apng, exr, dds, gif, hdr, jpg, tif, ico, webp, and bmp files. Uses Dear ImGui, OpenGL, and Tacent. Useful for game devs as it displays information like the presence of an alpha channel and querying specific pixels for their colour.

Tristan Grimmer 159 Dec 31, 2022
PNG encoder and decoder in C and C++.

PNG encoder and decoder in C and C++, without dependencies

Lode Vandevenne 1.7k Dec 25, 2022
Fast streaming PNG<->QOI converter with some compression-improving extensions

QOIG Fast streaming PNG<->QOI converter with some compression-improving extensions. Can achieve 1%-10% better compression than QOI without sacrificing

David Rutter 3 Oct 3, 2022