Link to home
Start Free TrialLog in
Avatar of zimmer9
zimmer9Flag for United States of America

asked on

Do you know how to write a C# function to create a .TIF image file ?

I am writing a C# application using VS2010 and .Net Framwork 4.0.

Do you know how to write a C# function to create a .TIF image file that contains the statement:   Image Not Available

 As for the properties of the .TIF image file, preferably it would have a width of about 1700 pixels and a height of about 650 pixels.

 You can look at the attached ImageNotAvailable.docx for the properties of another .TIF image file I am also working with.
ASKER CERTIFIED SOLUTION
Avatar of Kyaw Wanna
Kyaw Wanna
Flag of Thailand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zimmer9

ASKER

Why is the text not centered in the following code?

How can the following code be modified to center the text?

            Bitmap bmp = new Bitmap(1024, 512);
            using (Graphics graph = Graphics.FromImage(bmp))
            {
                Rectangle ImageSize = new Rectangle(0, 0, 1024, 1024);
                StringFormat sf = new StringFormat();
                sf.LineAlignment = StringAlignment.Center;
                sf.Alignment = StringAlignment.Center;

                graph.FillRectangle(Brushes.White, ImageSize);
                graph.DrawString("IMAGE NOT AVAILABLE", new Font("Tahoma", 50), Brushes.Black, ImageSize, sf);
               
            }

            bmp.Save(TARGET_DIR_IN + "_Blank.TIF");
Avatar of zimmer9

ASKER

Rectangle ImageSize = new Rectangle(0, 0, 1024, 1024);

I used the wrong value   s/b      

 Rectangle ImageSize = new Rectangle(0, 0, 1024, 512);