dqoi 1.0.0 dqoi: ^1.0.0 copied to clipboard
A Dart implementation of the "Quite OK Image Format", with a command line interface for console use and a library for use in applications.
dqoi ('dart_qoi') #
A Dart implementation of the "Quite OK Image Format", with a command line interface for console use and a library for use in applications.
Based off of the official C implementation and other implementations.
Command Line Interface #
Currently only Windows is supported for the CLI, as I cannot test on other operating systems. When I release the full version, there should be at least a Linux CLI.
Setup #
Very little setup is required. If you want to clone the source from GitHub you can. Then you can build and start using the 'bin/dqoi.exe' executable on Windows.
Alternatively, you can just install the package as normal, as use dqoi
from the command line once activated. See the installation instructions on pub-web.flutter-io.cn for more information.
CLI Usage #
You can list the available options by just running the executable with no arguments or with '--help'.
dqoi-test.bat
is designed to test the CLI on Windows, by comparing the files with official samples.
Application Library #
Installation #
There are two included libraries, each of which are very similar. Flutter applications should use the standard package:dqoi/dqoi.dart
import. The other dqoi_pure.dart
file excludes some useful extensions.
When this documentation refers to the singular "library", it means either library.
Library Usage #
The QOI
class provides conversions between binary, PNG, and QOI formats. When extended by FlutterQOIExts
, it also provides an easy way to render a QOI image in a Flutter app efficiently.
Note that neither library uses 'dart:io', so both are fully compatible with Web construction.
Examples #
You can build and install the example application, found in the 'example/' directory. However, below are some quick useful snippets to get you started.
Here's a way to convert PNG to QOI:
await outputFile.writeAsBytes(QOI.fromPNG(await inputFile.readAsBytes()).toQOI());
Here's the way to render a QOI image without converting to any other formats first:
QOI.fromQOI(await inputFile.readAsBytes()).toImageWidget(loadingWidget: loadingWidget);
FAQ #
- How do I pronounce the name of this library?
It's up to you, but I like "decoy" best. - Is this a good implementation?
The outputted QOI files perfectly match the official C implementation's outputs. The re-encoded PNGs don't always match byte-for-byte, but the pixels are always correct - Why wasn't this ported to Dart sooner?
I'm not sure either. You can see all the other available ports on the official README.