Image processing library implemented as Erlang NIF using FreeImage and Libpngquant
Erlimage is designed as a read, transform, write workflow. The really cool thing about Erlimage is that the actual pixelbuffer is returned as Binary to Erlang as well as some metadata.
You read an image file, apply an arbitrary amount of transformations, and lastly write the end result to disk.
- Ubuntu 17.10
- Ubuntu 16.04
- Fedora 27
- Windows 10 x64 (Compile via MinGW gcc) See usage on Windows section below
- gcc
- g++
Please note that that Windows is only supported with Erlang/OTP 21.0 and higher. Since this release the folder containing the nif's dll is automatically added to the dll search path (OTP-14666). Erlimage uses this functionality to load it's depencency.
Please note on fedora and possibly other linux distro's that use yum as package manger the g++ compiler is called gcc-c++
Add {erlimage, {git, "https://github.com/eyedouble/erlimage.git", {tag, "X.Y.Z-Z1"}}}
to the rebar.config
file of your application and add erlimage
to your application.src
file. Where X.Y.Z-Z1 is the release tag. See the releases tab for the latest release.
readFile ( "test.jpg" ).
> {ok, {witdth, 100, height, 100, pitch, 4, bpp, 32, data, <<0,0,0,...>>}}
Filename, Data object, Quality (0-100), Progressive (0,1)
writeJpg ( "test.jpg", DataOb, 75, 0 ).
> {ok, "written"}
Filename, Data object, Quality (0-100), Lossless (0,1)
writeJpg ( "test.webp", DataOb, 75, 0 ).
> {ok, "written"}
Not implemented yet.
Not implemented yet.
Not implemented yet.
Not implemented yet.
Not implemented yet.
Not implemented yet.
Not implemented yet
Not implemented yet
Not implemented yet
Not implemented yet
Not implemented yet
Data object, Width, Height, Algorithm (0-5)
Rescale takes three arguments and an optional fourth one.
The first argument Data object should be populated with a Object return by readFile/1
.
The second argument is the destination width in pixels.
The third argument is the destination height in pixels.
The fourth optional argument can be used to set the resampling algorithm. It defaults to bicubic resampling.
- 0: FILTER_BICUBIC Mitchell and Netravali's two-param cubic filter
- 1: FILTER_BOX Box, pulse, Fourier window, 1st order (constant) B-Spline
- 2: FILTER_BILINEAR Bilinear filter
- 3: FILTER_BSPLINE 4th order (cubic) B-Spline
- 4: FILTER_CATMULLROM Catmull-Rom spline, Overhauser spline
- 5: FILTER_LANCZOS3 Lanczos-windowed sinc filter
rescale ( DataOb, 500, 500, 0 ).
> {ok, {witdth, 500, height, 500, pitch, 4, bpp, 32, data, <<0,0,0,...>>}}
DataOb, Degrees Not implemented yet
version().
> {ok, "Erlimage:x.x.x;Y:x.x.x;"}
To build erlimage on Windows 64bit you need to provide GNU gcc and g++ compilers. Follow the steps below:
-
Download MinGW64 for Windows 64bit , and unzip to
C:\mingw64
. -
Add
C:\mingw64\bin
to your Path environment variable. ( On Windows 10: Open the Start menu, typeenvironment
in the results click onEdit environment variables for your account
. Select thePath
entry and click onEdit
. ) -
Open CMD or Powershell and execute
gcc --version
. It should show you the gcc version that is present. Do the same for g++. You are now done, please see the section Install to continue. -
Note that the latest version of Erlimage on Windows is only compatible with Erlang/OTP 21 or higher.