'C# Image 0,0 start point is not top left for all images

I have a folder with images and I want to draw a rectangle from the top left corner

This is the code I am using:

            Image image = Image.FromFile(path + $@"origimages\{item.ImageName}.jpg");

            using (Graphics g = Graphics.FromImage(image))
            {
                Color customColor = Color.FromArgb(50, Color.Red);
                SolidBrush shadowBrush = new SolidBrush(customColor);
                g.FillRectangles(shadowBrush, new RectangleF[] { new RectangleF(0, 0, 100, 100) });
            }

When I run this code over all my images, some images have the rectangle at the right up corner and some at the bottom right corner.

How can I fix that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source