Discussion:
labels for CD/DVDs - programmatically from script
Scott Serr
2011-07-27 19:04:10 UTC
Permalink
Hello image gurus,

I've spent a couple hours trying to get text in regions of a square background. First I just want 2 regions, the upper portion and lower portion of a CD. (I'll be using this with lightscribe DVDs)

I've avoided "-draw" because I didn't see a way to center horizontally. So...

I've tried doing parenthesis for this regions and then doing a -composite into the larger background.

This sort of works:

convert -size 480x480 xc:skyblue \
\( -size 460x140 -font Helvetica -pointsize 24 -gravity center \
label:'Red Hat Enterprise Linux\nStuff' \) \
-geometry +0-150 -composite \
\( -size 460x140 -font Helvetica -pointsize 24 -gravity center \
label:'Version 5.6\nx86-64' \) \
-geometry +0+150 -composite \
gif:- | display gif:-

The bottom text shows it's resized larger during compositing. I'd like the two 460x150 region with a fixed sized font to be composited as is. (trimmed in length of they are too long would be fine)

Any help is appreciated,
Scott
Scott Serr
2011-07-27 19:49:08 UTC
Permalink
Post by Scott Serr
convert -size 480x480 xc:skyblue \
\( -size 460x140 -font Helvetica -pointsize 24 -gravity center \
label:'Red Hat Enterprise Linux\nStuff' \) \
-geometry +0-150 -composite \
\( -size 460x140 -font Helvetica -pointsize 24 -gravity center \
label:'Version 5.6\nx86-64' \) \
-geometry +0+150 -composite \
gif:- | display gif:-
The bottom text shows it's resized larger during compositing. I'd
like the two 460x150 region with a fixed sized font to be composited
as is. (trimmed in length of they are too long would be fine)
I was a bit off:

"Before version 6.5.2-4, IM would completely ignore the "-pointsize" setting if a "-size" setting is also given. This causes the text in the above images to be auto-sized according to the 'best fit' handling (see next set of examples)."

I'm wondering how I can work around this with an old version, 6.2.8.

-Scott
Anthony Thyssen
2011-07-28 02:33:04 UTC
Permalink
On Wed, 27 Jul 2011 13:49:08 -0600 (MDT)
magick-users-***@imagemagick.org wrote:
|
| ----- "Scott Serr" <***@theserrs.net> wrote:
|
| > This sort of works:
| >
| > convert -size 480x480 xc:skyblue \
| > \( -size 460x140 -font Helvetica -pointsize 24 -gravity center \
| > label:'Red Hat Enterprise Linux\nStuff' \) \
| > -geometry +0-150 -composite \
| > \( -size 460x140 -font Helvetica -pointsize 24 -gravity center \
| > label:'Version 5.6\nx86-64' \) \
| > -geometry +0+150 -composite \
| > gif:- | display gif:-
| >
| > The bottom text shows it's resized larger during compositing. I'd
| > like the two 460x150 region with a fixed sized font to be composited
| > as is. (trimmed in length of they are too long would be fine)
|
| I was a bit off:
|
| "Before version 6.5.2-4, IM would completely ignore the "-pointsize" setting if a "-size" setting is also given. This causes the text in the above images to be auto-sized according to the 'best fit' handling (see next set of examples)."
|
| I'm wondering how I can work around this with an old version, 6.2.8.
|
generate your text, then center compose it onto a 460x150 sized image,
after that you can compose that onto your background.




Anthony Thyssen ( System Programmer ) <***@griffith.edu.au>
--------------------------------------------------------------------------
Science is based on not knowing everything, but it does know somethings.
-- Terry Pratchett, "Science of Diskworld"
--------------------------------------------------------------------------
Anthony's Castle http://www.ict.griffith.edu.au/anthony/

Fred Weinhaus
2011-07-28 00:31:26 UTC
Permalink
The resizing occurs to the last image in the sequence when using
-geometry without a size. You may be better off using -page ...
-flatten. But -page is not gravity sensitive.

Or you might try using -geometry 100x100%+x+y and see if that
preserves the size of the last image. I have not tried this to be
sure it works.

See
http://www.imagemagick.org/Usage/layers/#convert
http://www.imagemagick.org/Usage/layers/#flatten

From the first link:

"Now the "-geometry" is is a very special operator that not only sets
an overlay position for the next "-composite" operation, it also
"-resize" the last image (and only the last image) in the current
image sequence."
Post by Scott Serr
Hello image gurus,
I've spent a couple hours trying to get text in regions of a square
background. First I just want 2 regions, the upper portion and
lower portion of a CD. (I'll be using this with lightscribe DVDs)
I've avoided "-draw" because I didn't see a way to center horizontally. So...
I've tried doing parenthesis for this regions and then doing a
-composite into the larger background.
convert -size 480x480 xc:skyblue \
\( -size 460x140 -font Helvetica -pointsize 24 -gravity center \
label:'Red Hat Enterprise Linux\nStuff' \) \
-geometry +0-150 -composite \
\( -size 460x140 -font Helvetica -pointsize 24 -gravity center \
label:'Version 5.6\nx86-64' \) \
-geometry +0+150 -composite \
gif:- | display gif:-
The bottom text shows it's resized larger during compositing. I'd
like the two 460x150 region with a fixed sized font to be composited
as is. (trimmed in length of they are too long would be fine)
Any help is appreciated,
Scott
Fred Weinhaus
2011-07-28 00:36:22 UTC
Permalink
Actually, you would probably be better off using -annotate rather
than label: as you are specifying a pointsize and size. Annotate is
gravity sensitive and has built-in offsets similar to using
-geometry. But it won't resize the last image.
Post by Scott Serr
Hello image gurus,
I've spent a couple hours trying to get text in regions of a square
background. First I just want 2 regions, the upper portion and
lower portion of a CD. (I'll be using this with lightscribe DVDs)
I've avoided "-draw" because I didn't see a way to center horizontally. So...
I've tried doing parenthesis for this regions and then doing a
-composite into the larger background.
convert -size 480x480 xc:skyblue \
\( -size 460x140 -font Helvetica -pointsize 24 -gravity center \
label:'Red Hat Enterprise Linux\nStuff' \) \
-geometry +0-150 -composite \
\( -size 460x140 -font Helvetica -pointsize 24 -gravity center \
label:'Version 5.6\nx86-64' \) \
-geometry +0+150 -composite \
gif:- | display gif:-
The bottom text shows it's resized larger during compositing. I'd
like the two 460x150 region with a fixed sized font to be composited
as is. (trimmed in length of they are too long would be fine)
Any help is appreciated,
Scott
Loading...