LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-20-2004, 02:33 AM   #1
barisdemiray
Member
 
Registered: Sep 2003
Location: Ankara/Turkey
Distribution: Slackware
Posts: 155

Rep: Reputation: 30
Centering text on an image using ImageMagick


I'm writing a script that takes button labels from user and creates buttons by using ImageMagick internally. Script takes label and passes parameters to ImageMagick but i cannot center text on an template image. Is there any predefined words like vcenter,hcenter for the -draw parameter's string? Or any way to get the length of a string (in pixels) at courier font for example? Any ideas? Thanks!
 
Old 09-20-2004, 10:56 AM   #2
Dave Kelly
Member
 
Registered: Aug 2004
Location: Todd Mission Texas
Distribution: Linspire
Posts: 215

Rep: Reputation: 31
Let me suggest you download a copy of;
abs-guide-2.6.orig
there is some information on string length in some of the examples on strings.

It may help.
Dave
 
Old 09-20-2004, 11:07 AM   #3
barisdemiray
Member
 
Registered: Sep 2003
Location: Ankara/Turkey
Distribution: Slackware
Posts: 155

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by Dave Kelly
Let me suggest you download a copy of;
abs-guide-2.6.orig
there is some information on string length in some of the examples on strings.

It may help.
Dave
Thanks for your time Dave. But i was trying to get the length of a string in `pixels'. But after a few hours i found the solution and there is no need to dive into pixels:

Code:
convert button-empty.png -font Verdana -pointsize 13 -gravity center -draw "text 0,0 'Sample Button'" button-sample.png
This will add the label "Sample Button" to your button-empty.png file with centering it. Also if we want to find the length of a string in characters, this can be done by:

Code:
[baris@rhinox]$ echo "This is a 30 character string"|wc -c
30
Anyway, thanks again Dave.
 
  


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
getting image size (imagemagick) btb Linux - General 6 10-15-2013 02:39 PM
lp with cups. Problems with centering image on paper jmgreen7 Linux - Software 0 04-13-2005 12:08 PM
Video 2 Image - ImageMagick For Videos ??? freebies Linux - Software 1 03-28-2005 03:17 PM
Resize Image using ImageMagick mddolloff Linux - Software 1 11-20-2004 05:07 PM
How to Add Text to An Image? VorlonInfoTech Linux - Software 1 02-01-2004 09:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:55 AM.

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