jpeg-turbod 0.1.1

A D wrapper for libjpeg-turbo.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

jpeg-turbod

A D wrapper for libjpeg-turbo.

Currently working on MacOS. Windows and Linux compatibility pending.

Requirements

  • libjpeg-turbo
  • Installation:
    • MacOS (via Homebrew): brew install jpeg-turbo
    • MacOS (via official installer): https://libjpeg-turbo.org/Documentation/OfficialBinaries

Usage

First install via dub: dub add jpeg-turbod

Then use in your program like so:

import std.file;
import std.stdio;

import jpeg_turbod;

void main()
{
    const auto jpegFile = "image.jpg";
    auto jpeg = cast(ubyte[]) jpegFile.read;

    auto dc = new Decompressor();
    ubyte[] pixels;
    int width, height;
    dc.decompress(jpeg, pixels, width, height);

    writefln("JPEG dimensions: %s x %s", width, height);
    writefln("First pixel: [%s, %s, %s]", pixels[0], pixels[1], pixels[2]);
}

During compilation dub will try to find libjpeg-turbo at the following locations:

  • On MacOS:
  • Homebrew path: /usr/local/opt/jpeg-turbo/lib
  • Installer path: /opt/libjpeg-turbo/lib

Todo

  • Windows compatibility
  • Linux compatibility
  • Documentation
  • Access to error information
  • Output of grayscale/B&W images
Authors:
  • Kyle Ingraham
Dependencies:
none
Versions:
0.2.0 2021-Mar-18
0.1.4 2021-Jan-18
0.1.3 2021-Jan-18
0.1.2 2021-Jan-18
0.1.1 2021-Jan-16
Show all 7 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 14 downloads total

Score:
0.3
Short URL:
jpeg-turbod.dub.pm