Full Image Support When Linking to C Libraries 

LibraryLink is extended to support Image objects being directly sent to/from external libraries.

Here is an example to create a sepia effect from a given image represented in a 32 bit real data type. See the complete example here.

static void isepia(raw_t_real32 *out, raw_t_real32 *in, mint width, 
        mint height, mint channels) { for (mint ii = 0; ii < height; ii++) { for (mint jj = 0; jj < width; jj++) { for (mint kk = 0; kk < channels; kk++) { mint index = channels * (ii * width + jj); raw_t_real32 r = in[index + 0]; ... out[index + 0] = r * static_cast<raw_t_real32>(0.393) + g * static_cast<raw_t_real32>(0.769) + b * static_cast<raw_t_real32>(0.189); ... for (int ii = 3; ii < channels; ii++) { out[index + ii] = in[index + ii]; } } } } return; } EXTERN_C DLLEXPORT int speia(WolframLibraryData libData, mint Argc,     MArgument *Args, MArgument res) {
    ...
    data_in = imgFuns->MImage_getReal32Data(image_in);     data_out = imgFuns->MImage_getReal32Data(image_out);     ...     ispeia(data_out, data_in, width, height, channels);     MArgument_setMImage(res, image_out);     return LIBRARY_NO_ERROR; }

Load the function from the library.

In[1]:=
Click for copyable input
X
Out[1]=

Apply the loaded function on any image.

In[2]:=
Click for copyable input
X
Out[2]=
de es ja pt-br zh