Using ImageMagick or GraphicsMagick on Azure Functions
Web Apps in Azure is a SaaS (Software as a Service). You deploy your bits to the Azure IIS containers, and Azure do the rest. We don’t get much control. So we will not have the privilege to install any 3rd party executable file on Azure Functions App (e.g. ImageMagick or GraphicsMagick). If you need to do that, look at Virtual Machines. Another option is using Cloud Services' Web or Worker Role.
Alternatively, there is a good image processing library for Node written entirely in JavaScript, with zero external or native dependencies, Jimp. https://github.com/oliver-moran/jimp
Example usage:
var Jimp = require("jimp");
Jimp.read("lenna.png").then(function (lenna) {
lenna.resize(256, 256) // resize
.quality(60) // set JPEG quality
.greyscale() // set greyscale
.write("lena-small-bw.jpg"); // save
}).catch(function (err) {
console.error(err);
});
There is another node.js library called sharp to achieve your requirement. You may try this way:
First, install the sharp on your local environment, and then deploy your application to Azure with the node_modules
folder which contains the compiled module. Finally, upgrade the node executable on Azure App Service to 64-bits.
The similar thread you can refer here.
Example usage:
var sharp = require("sharp");
sharp(inputBuffer)
.resize(320, 240)
.toFile('output.webp', (err, info) => {
//...
});
You can use the site extension to make imagemagick work for azure web apps.
You can check the repository for more info: https://github.com/fatihturgut/azure-imagemagick-nodejs
Azure functions can run custom docker images also
https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-function-linux-custom-image
Not sure which language you are interested in, but you can have a python image with below style Dockerfile
FROM mcr.microsoft.com/azure-functions/python:2.0
RUN apt-get update && \
apt-get install -y --no-install-recommends apt-utils && \
apt-get install -y imagemagick
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY . /home/site/wwwroot
RUN cd /home/site/wwwroot && \
pip install -r requirements.txt
And then use the PythonMagick to work with the same