Search code examples
c#.nettextsystem.drawing

How to add text to image and have the font adjust to the image size.


Suppose i have a phone that i take an image with, i want to take that image and add some text, the text might be long it will contain gps cordinates and date and time of when the image was taken.

In C# .Net by using Graphics, how does one make the font resize according to the image, because when i draw a text, it might fit in the portrait mode image, but in the landscape image it becomes wery small.

Thanks for the answers in advance


Solution

  • There is a function available in Graphics context to measure it. You can refer the following article for more details

    https://msdn.microsoft.com/en-us/library/bb986765.aspx