Good day,
When trying to use your component, an error is thrown when trying to use the Rotate function. It occurs on both jpg- and png-images and of several file sizes.================================================System.ArgumentNullException: Value cannot be null.
Parameter name: encoder
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at OutSystems.NssSmart_Image_Utils.CssSmart_Image_Utils.StreamToBinary(Bitmap bitmap, ImageCodecInfo Encoder, EncoderParameters Params, ImageFormat ImageFormat)
at OutSystems.NssSmart_Image_Utils.CssSmart_Image_Utils.MssRotate_Image(Byte[] ssOriginalImage, Decimal ssDegrees, Byte[]& ssRotatedImage, String& ssErrorMessage)
================================================
It seems something is not mapped correctly, as both the binary and degrees input is in fact filled. Above error can also be reproduced on the Demo application of this component.
Can you take a look at what might go wrong?
Thank you in advance.
The error is caused by a null image encoder, not by your inputs.
Image.Save(stream, encoder, encoderParams) fails because encoder is null. This means the component is unable to resolve the correct JPEG/PNG encoder (a known issue in this Forge asset, confirmed since it also happens in the demo app).
Fix: handle the null encoder in the component code:
if (Encoder == null)
{
bitmap.Save(stream, ImageFormat.Png); // fallback
}
else
bitmap.Save(stream, Encoder, Params);
Or simpler (recommended):
bitmap.Save(stream, ImageFormat.Png);
Conclusion:
Not an input issue — it’s a bug in the Smart Image Utils component due to missing encoder resolution.
Thank you for your AI-generated answer...
Component hasn't been updated for a year.
Why not ask to join the component team and apply the fix above?
Is a great way to learn and help the community.
Hello Geertjan,
Thank you for your feedback, I’ll make sure to test your scenario and run a few tests after the fix, letting you know when the new version is uploaded so you can downloaded it.
Maybe I can make it before the weekend but can’t confirm it since I’m a little busy at the moment.
Best regards,
Aureliano Pinheiro
Hi Aureliano,
Happy to help if needed.Remember, a problem shared becomes somebody else problem!
Kind Regards,
Nathan