Using .Net. We are having trouble getting Aspose.Imaging to run within an Azure Function. The error coming back is
Unable to find assembly ‘Aspose.Imaging, Version=19.4.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’.
However all prior Aspose.Imaging class and method reference work until the .Save operation happens which is when we get the error. I suspect the issue is that the Aspose.Imaging is needed a dependency but have no idea what it would need. Example:
JpegImage jpegImage = (JpegImage)image;
jpegImage.AutoRotate();
var resizeDimentions = SetResizeParameters(jpegImage.Height, jpegImage.Width, imageCompressRequest);
if (resizeDimentions != null)
jpegImage.Resize(resizeDimentions.Width, resizeDimentions.Height);
var jpegOptions = new JpegOptions()
{
CompressionType = JpegCompressionMode.Progressive,
Quality = GetJpegQuality(imageCompressRequest.CompressionLevel)
};
var resultStream = new MemoryStream();
jpegImage.Save(resultStream, jpegOptions);
return resultStream.ToArray();
The error happens on the jpegImage.Save operation. The stack trace we get is below. Do note this does not happen if the exact same code runs in say class in a ASP.Net or command line setting.
at Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)
at Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase)
at nkf.Integration.ImageProcessing.Function.Services.ImageAsposeCompressService.<CompressJpeg>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at nkf.Integration.ImageProcessing.Function.Services.ImageAsposeCompressService.<Compress>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at nkf.Integration.ImageProcessing.Functions.Compress.<Run>d__0.MoveNext()