We have checked the code snippet shared by you and it looked like you are using Aspose.Imaging. We are moving this thread to respective category where you will be assisted accordingly.
I have worked with the information shared by you and have been able to observe the issue. An issue with ID IMAGINGJAVA-1401 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.