Not sure if it's in Firebase scope but it's in Firebase official docs.
I tried to implement a moderate-image example which worked quite well https://github.com/firebase/functions-samples/blob/Node-8/moderate-images/functions/index.js
It took about 1 minute to get the download url of a blurred image. Then I tried quite the same ImageMagick function with partial blur:
await spawn('convert', [tempLocalFile, '-region', '10x10+5+5', '-blur', '0x8', tempLocalFile]);
It also worked without issues and took the same time.
Then I tried to perform a sequence of this operation like this:
for (const i in regions) await spawn('convert', [tempLocalFile, '-region', i, '-blur', '0x8', tempLocalFile]);
There were 8 elements in regions, so convert operation was performed 8 times.
On the 2nd minute the console showed Function execution took 60003 ms, finished with status: 'timeout'. On the 9th minute I received the image with 8 blurred regions as intended.
So the questions are:
- Is it normal time for such a basic image manipulation?
- Could it be somehow accelerated?
- What workflow could it be if one decide to get Cloud Vision result JSON, perform all image manipulations client-side and then re-upload the final image back to Firebase?