Can anyone guide how to generate image from input text. Image might have any extension doesn't matter.
相关问题
- Views base64 encoded blob in HTML with PHP
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- How to get the background from multiple images by
- Why am I getting UnauthorizedAccessException on th
use imagemagick for rendering text on images (on the server)
Since you are in C# you could also use the .Net classes for bitmap and font manipulation directly (with the classes like:
System.Drawing.Bitmap
andSystem.Drawing.Graphics
)I just translated this method mentioned in this answer to a VB.NET method. Maybe this helps someone.
Edit: Fixed typo.
Ok, assuming you want to draw a string on an image in C#, you are going to need to use the System.Drawing namespace here:
This code will measure the string first, and then create an image of the correct size.
If you want to save the return of this function, just call the Save method of the returned image.
F#
version:Thanks Kazar. A slight improvement of the previous answer to use USING for the dispose of the image/graphic objects after used and the introduction of min size param