I recently had to work on a project where I needed to open an image, rotate it by 90 degrees and save it again in C#. I was having some issues where it would always save the image in the PNG format regardless of what format it was loaded from. Here’s the code that I had:

It turns out that you can’t pass the image format into the save function directly like that. You need to save it first or it will default back to PNG format. See the following code:

I hope this helps someone.