Use an Azure function in Business Central
Because an Azure function is implemented through an HTTP request, you can use the same code to connect to an Azure function as you would when connecting to a REST service.
The ChangeToBlackAndWhitePicture variable will post an image to the Azure function. The Azure function adds a grayscale filter and then returns the image as an HTTP response.
procedure ChangeToBlackAndWhitePicture(Item: Record Item)
var
TenantMedia: Record "Tenant Media";
Client: HttpClient;
Content: HttpContent;
ResponseMessage: HttpResponseMessage;
Stream: InStream;
Url: Text;
begin
if not (Item.Picture.Count() > 0) then
exit;
if not TenantMedia.Get(Item.Picture.Item(1)) then
exit;
TenantMedia.CalcFields(Content);
if not TenantMedia.Content.HasValue() then
exit;
TenantMedia.Content.CreateInStream(Stream);
Content.WriteFrom(Stream);
Url := 'https://mywebsite.com/ImageConverter';
if not client.Post(Url, Content, ResponseMessage) then
exit;
if not ResponseMessage.IsSuccessStatusCode() then
exit;
ResponseMessage.Content().ReadAs(Stream);
Clear(Item.Picture);
Item.Picture.ImportStream(Stream, 'New Image');
Item.Modify(true);
end;