How to open a bitmap file, draw a string to it and save it programmatically using gcc
Hi
I need to load a bitmap file, then write (or draw) a string to it in a specific position with my chosen font and size, then save it back to the hard disk.
This is straightforward in Java and C# and so on. But I can't find any documentation for doing this GCC in linux.
for example this is the code in java:
import java.awt.image.*;
import java.awt.Canvas.*;
import javax.imageio.*;
BufferedImage img = ImageIO.read(newFile(InputBitmapFilename));
Graphics g = img.getGraphics();
g.setColor(selectedColor);
g.setFont(new Font("Tahoma", Bold, Size));
g.drawString("The Text", Xpos, Ypos);
g.dispose();
File outputfile = new File(OutputInputBitmapFilename);
ImageIO.write(img, "bmp", outputfile);
Regards,
Mehrdad Seyrafi
|