LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-08-2013, 06:13 AM   #1
mehseyrafi
LQ Newbie
 
Registered: Apr 2013
Posts: 8

Rep: Reputation: Disabled
Thumbs up 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
 
Old 04-08-2013, 07:02 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well this is nothign at all to do with gcc. gcc is just a compiler. There are LOADS of graphics libraries you could use. I'd personally use glib. or an interface to imagemagick like http://www.imagemagick.org/script/magick-wand.php
 
1 members found this post helpful.
Old 04-08-2013, 09:06 AM   #3
mehseyrafi
LQ Newbie
 
Registered: Apr 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thank you chris for your reply. But I couldn't find any information on using glib for my case. Could you please give me more advice. Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I save gcc output in a file ? techsavvy Linux - General 3 06-24-2008 07:38 AM
how to draw a bitmap in the window using xlib mirsoft Programming 1 02-10-2008 09:38 AM
how to draw a bitmap in the window using xlib mirsoft Programming 4 01-23-2008 06:56 PM
Fastest way to draw a 16 or 32 bit RGB bitmap in XLIB (without GL)? fcdev Programming 1 11-14-2007 03:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration