c#- Drawing rectangle on a Tiff image bloats the file
Hi I am trying to add a small rectanlge graphics on a exiting Tiff file using C# and sav it back as a new tiff file. But the image sevelry bloats from 118kb to 954 kb just for adding a small rectangle. My original image doesn't have any color except black and white(may be greyscale). The rectangle box that I am drawing uses black color.
Please help in fixing this issue.
Thanks for responding.
Getting Error:
A Graphics object cannot be created from an image that has an indexed pixel format.
at the line
Graphics g = Graphics.FromImage(img);
Any suggestions?
hasan_tek
ASKER
I tried your approach before and got the error and somebody suggested the alternate way of creating a bitmap(my original code) but that bloats the resulting tiff...
Bitmap bm = new Bitmap(org.Width, org.Height,org.PixelFormat);
but its giving the same error :
A Graphics object cannot be created from an image that has an indexed pixel format.
Open in new window