In some kind of way a not so easy bug has sneaked its way into this little piece of code without my knowledge of fixing it:
static void Main(string[] args)
{
Bitmap bm = new Bitmap(1, 1);
bm.SetPixel(1, 1, Color.AliceBlue);
bm.Save("C:\\Users\\Lasse\\Pictures\\Midlertidigt\\hej.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);//
Console.ReadLine();
}
The exception:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in System.Drawing.dll
Additional information: Parameter must be positive and < Width.
You've created an image with a height and width of 1. Coordinates start at 0, therefore the only valid first two arguments two SetPixel
are 0:
bm.SetPixel(0, 0, Color.AliceBlue);
The only confusing thing is how this could ever have worked, as implied by your description.
See more on this question at Stackoverflow