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.
Hello @Geertjan Jacobs ,
Thank you for waiting, I have done a few changes on this asset code and already uploaded a new version to Forge, let me know if it worked for you and if it did don´t forget to mark this comment as a solution.Sorry for the delay´s have a great week.
Best Regards,
Aureliano Pinheiro
Hi Aureliano,
I've upgraded the component to v1.1.6 and the error does not occur anymore when using the Rotate function.
Thank you very much for your swift response and solution.
Have a great day.
Thank you for your feedback, glad it worked, if you find any further issue don´t hesitate to report it so I can have a look.
Have a great week,Best Regards
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,
Happy to help if needed.Remember, a problem shared becomes somebody else problem!
Kind Regards,
Nathan
I guess your suggestion is not ill-intentioned, but telling others to just fix problems in other people's components is a strange advise. These forums are to share your own issues so others can find similar situations (and solutions), and for the creator of the component to know about bugs so they can be fixed.
I might even question the fix-it-yourself mentality, as it is a great way for a developer to drown or waste time in the numerous challenges one can encounter when using 3rd party software.
After all, "Forge is a repository of reusable, open code modules, connectors, UI components, and business solutions to help speed up your OutSystems apps delivery time".Without diving into someone else's code, I've already tried to be useful by testing and sharing info regarding the various file types and sizes it occurred, including its own demo application. As this function is not business critical, we didn't mind waiting for a solution.
Nevertheless, the creator responded quickly and released a fix for everyone to enjoy. :)
I understand your point of view, but the Forge and Forums are a community.
People who create forge components generally aren't being paid for it, and support them on a best endeavours basis... Forge components are usually open source, and many hands make light work.
The "fix-it-yourself mentality" is a great way for developers to expand your own capabilities and contribute to the community.
It's clear we differ in our perspectives in this matter. To be clear, I don't mind getting my hands dirty on analyzing bugs or handling complex pieces of code. But not every developer has the time, expertise or context to investigate and fix issues. Expecting every consumer to be a contributor is certainly not realistic.
Most probably, Aureliano has fixed this matter in a lot less time than it would take for me to communicate, join the team, read documentation, understand architecture/design decisions, find a solution, fix the code, test and submit a new version.
Personally, I would not expect anyone using my software to join in and give solutions to any component I own. In fact, it would be counterproductive with more contributors, because it creates more overhead and extra effort to check if the other person's code is in line with previous considerations, guidelines and current design decisions.
Anyway, this discussion has nothing to do with the issue in the topic so I will conclude with an 'agree to disagree'.
Have a nice day!