Hi @moondaddy ,
Based on your description and the code you provided, I created two test simples (console app and WebApi, tested in windows 10
) to try to reproduce your issue, but unlucky I failed. They all work correctly (use the code you provided and modify some param). And you mention in your description that this issue happens intermittently, so I think I'd have to ask for more details to determine the cause of the problem or get this issue to be reproduced.
- When this problem occurs, does a file with the same name already exist in the corresponding path? Because when a file with the same name exists and it is occupied by another process, performing the
Image.Save()
method may cause such a problem. - Checks if the image size exceeds
65535 pixels
, and if this is the case, it will throw the relevant exception. - Have you also encountered the same error in other environments? Because I see you mentioned that this problem happens in
windows server 2019
andwindows11
. And you also need to make sure you have file write permission.
In addition, if you can provide more detailed test info, it will help to solve the problem, such as image resources, test path and possible test steps, etc. Thank you for your understanding.
Best regards,
Xudong Peng
If the answer is the right solution, please click "Accept Answer" and kindly upvote. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.