Modify code to add top header ImageMagick
Please some help here. I´m using IM 6.9.10-11 Q16 x86_64
The following coordinates correlative are related with the box number in input image. The first 3 lines in convert command create a
header text "Left - Right" that goes over the img2.png and img3.png
coord1="98x35+234+16"
coord2="178x59+29+65"
coord3="178x59+223+65"
coord4="178x59+417+65"
coord5="178x59+611+65"
coord6="239x147+35+179"
coord7="239x147+416+179"
coord8="239x147+73+349"
coord9="239x147+401+353"
convert
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Left" )
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Right" )
-background white +smush +2 -write mpr:leftright +delete +gravity
input.png +repage -write mpr:img -delete 0--1 -background none -bordercolor "#870000"
( mpr:img -crop $coord2 )
( mpr:img -crop $coord3 )
( mpr:img -crop $coord4 )
( mpr:img -crop $coord5 )
-border 4 ( -clone 0,1 -smush -4 ) ( -clone 2,3 -smush -4 ) -delete 0-3 -gravity center +smush -4 +gravity
( mpr:img -crop $coord1 -border 4 ) +swap -gravity center -smush +12 +gravity -write Img1.png
( ( mpr:img -crop $coord6 +repage -border 4 ) ( mpr:img -crop $coord7 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity -write Img2.png ) -delete 0--1
( ( mpr:img -crop $coord8 +repage -border 4 ) ( mpr:img -crop $coord9 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity -write Img3.png ) null:
With this input.png
input.png
The code produces this 3 images.
Img1.png
Img2.png
Img3.png
What I´d like is to modify the current code to add a top header text to each one of these 3 images before they be created (before -write)
In order that the Img1, Img2 and Img3 be finally like this:
Desired Img1
Desired Img2
Desired Img3
I think I need to create the images first at the beginning of the convert command, something like this, but I don´t know how to adapt it and insert these lines within the current code.
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Five boxes" )
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Blue boxes" )
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Green boxes" )
Thanks for any help.
text header imagemagick-convert
add a comment |
Please some help here. I´m using IM 6.9.10-11 Q16 x86_64
The following coordinates correlative are related with the box number in input image. The first 3 lines in convert command create a
header text "Left - Right" that goes over the img2.png and img3.png
coord1="98x35+234+16"
coord2="178x59+29+65"
coord3="178x59+223+65"
coord4="178x59+417+65"
coord5="178x59+611+65"
coord6="239x147+35+179"
coord7="239x147+416+179"
coord8="239x147+73+349"
coord9="239x147+401+353"
convert
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Left" )
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Right" )
-background white +smush +2 -write mpr:leftright +delete +gravity
input.png +repage -write mpr:img -delete 0--1 -background none -bordercolor "#870000"
( mpr:img -crop $coord2 )
( mpr:img -crop $coord3 )
( mpr:img -crop $coord4 )
( mpr:img -crop $coord5 )
-border 4 ( -clone 0,1 -smush -4 ) ( -clone 2,3 -smush -4 ) -delete 0-3 -gravity center +smush -4 +gravity
( mpr:img -crop $coord1 -border 4 ) +swap -gravity center -smush +12 +gravity -write Img1.png
( ( mpr:img -crop $coord6 +repage -border 4 ) ( mpr:img -crop $coord7 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity -write Img2.png ) -delete 0--1
( ( mpr:img -crop $coord8 +repage -border 4 ) ( mpr:img -crop $coord9 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity -write Img3.png ) null:
With this input.png
input.png
The code produces this 3 images.
Img1.png
Img2.png
Img3.png
What I´d like is to modify the current code to add a top header text to each one of these 3 images before they be created (before -write)
In order that the Img1, Img2 and Img3 be finally like this:
Desired Img1
Desired Img2
Desired Img3
I think I need to create the images first at the beginning of the convert command, something like this, but I don´t know how to adapt it and insert these lines within the current code.
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Five boxes" )
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Blue boxes" )
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Green boxes" )
Thanks for any help.
text header imagemagick-convert
add a comment |
Please some help here. I´m using IM 6.9.10-11 Q16 x86_64
The following coordinates correlative are related with the box number in input image. The first 3 lines in convert command create a
header text "Left - Right" that goes over the img2.png and img3.png
coord1="98x35+234+16"
coord2="178x59+29+65"
coord3="178x59+223+65"
coord4="178x59+417+65"
coord5="178x59+611+65"
coord6="239x147+35+179"
coord7="239x147+416+179"
coord8="239x147+73+349"
coord9="239x147+401+353"
convert
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Left" )
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Right" )
-background white +smush +2 -write mpr:leftright +delete +gravity
input.png +repage -write mpr:img -delete 0--1 -background none -bordercolor "#870000"
( mpr:img -crop $coord2 )
( mpr:img -crop $coord3 )
( mpr:img -crop $coord4 )
( mpr:img -crop $coord5 )
-border 4 ( -clone 0,1 -smush -4 ) ( -clone 2,3 -smush -4 ) -delete 0-3 -gravity center +smush -4 +gravity
( mpr:img -crop $coord1 -border 4 ) +swap -gravity center -smush +12 +gravity -write Img1.png
( ( mpr:img -crop $coord6 +repage -border 4 ) ( mpr:img -crop $coord7 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity -write Img2.png ) -delete 0--1
( ( mpr:img -crop $coord8 +repage -border 4 ) ( mpr:img -crop $coord9 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity -write Img3.png ) null:
With this input.png
input.png
The code produces this 3 images.
Img1.png
Img2.png
Img3.png
What I´d like is to modify the current code to add a top header text to each one of these 3 images before they be created (before -write)
In order that the Img1, Img2 and Img3 be finally like this:
Desired Img1
Desired Img2
Desired Img3
I think I need to create the images first at the beginning of the convert command, something like this, but I don´t know how to adapt it and insert these lines within the current code.
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Five boxes" )
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Blue boxes" )
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Green boxes" )
Thanks for any help.
text header imagemagick-convert
Please some help here. I´m using IM 6.9.10-11 Q16 x86_64
The following coordinates correlative are related with the box number in input image. The first 3 lines in convert command create a
header text "Left - Right" that goes over the img2.png and img3.png
coord1="98x35+234+16"
coord2="178x59+29+65"
coord3="178x59+223+65"
coord4="178x59+417+65"
coord5="178x59+611+65"
coord6="239x147+35+179"
coord7="239x147+416+179"
coord8="239x147+73+349"
coord9="239x147+401+353"
convert
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Left" )
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Right" )
-background white +smush +2 -write mpr:leftright +delete +gravity
input.png +repage -write mpr:img -delete 0--1 -background none -bordercolor "#870000"
( mpr:img -crop $coord2 )
( mpr:img -crop $coord3 )
( mpr:img -crop $coord4 )
( mpr:img -crop $coord5 )
-border 4 ( -clone 0,1 -smush -4 ) ( -clone 2,3 -smush -4 ) -delete 0-3 -gravity center +smush -4 +gravity
( mpr:img -crop $coord1 -border 4 ) +swap -gravity center -smush +12 +gravity -write Img1.png
( ( mpr:img -crop $coord6 +repage -border 4 ) ( mpr:img -crop $coord7 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity -write Img2.png ) -delete 0--1
( ( mpr:img -crop $coord8 +repage -border 4 ) ( mpr:img -crop $coord9 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity -write Img3.png ) null:
With this input.png
input.png
The code produces this 3 images.
Img1.png
Img2.png
Img3.png
What I´d like is to modify the current code to add a top header text to each one of these 3 images before they be created (before -write)
In order that the Img1, Img2 and Img3 be finally like this:
Desired Img1
Desired Img2
Desired Img3
I think I need to create the images first at the beginning of the convert command, something like this, but I don´t know how to adapt it and insert these lines within the current code.
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Five boxes" )
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Blue boxes" )
( -size 500x36 xc:"#757575" -fill white -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Green boxes" )
Thanks for any help.
text header imagemagick-convert
text header imagemagick-convert
asked Nov 13 '18 at 20:45
Ger CasGer Cas
347111
347111
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
In ImageMagick you can create images anywhere in parenthesis and reposition them with -swap ... (or +swap for the last two). So your command would become:
coord1="98x35+234+16"
coord2="178x59+29+65"
coord3="178x59+223+65"
coord4="178x59+417+65"
coord5="178x59+611+65"
coord6="239x147+35+179"
coord7="239x147+416+179"
coord8="239x147+73+349"
coord9="239x147+401+353"
convert
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Left" )
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Right" )
-background white +smush +2 -write mpr:leftright +delete +gravity
input.png +repage -write mpr:img -delete 0--1 -background none -bordercolor "#870000"
( mpr:img -crop $coord2 )
( mpr:img -crop $coord3 )
( mpr:img -crop $coord4 )
( mpr:img -crop $coord5 )
-border 4 ( -clone 0,1 -smush -4 ) ( -clone 2,3 -smush -4 ) -delete 0-3 -gravity center +smush -4 +gravity
( mpr:img -crop $coord1 -border 4 ) +swap -gravity center -smush +12 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Five Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img1.png
( ( mpr:img -crop $coord6 +repage -border 4 ) ( mpr:img -crop $coord7 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Blue Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img2.png ) -delete 0--1
( ( mpr:img -crop $coord8 +repage -border 4 ) ( mpr:img -crop $coord9 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Green Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img3.png ) null:
And the results are:
Unfortunately, in IM 6 there is no way to know how wide your smushed colored images will be so as to make the title the same width unless you compute that ahead of time. In IM 7, it can be done in-line in your command line. So here I made it the same width as the two left right smushed images. You can change the width by changing the width value in -size 250x36.
Just great. Thanks so much one more time. I see that you didn't use "mpr" to create the top headers, then to create the Left-Right headers could be done in the same way? I mean without use mpr? Additionally what does mean-delete 0--1
and why sometimes use + or - gravity?
– Ger Cas
Nov 14 '18 at 2:11
mpr: was needed to avoid repeatedly reading your input image. -delete 0--1 means to delete all the previous image in the command sequence 0 is the first and -1 is the last. So 0--1 means from the first to the last. -gravity is needed when setting a gravity for use. +gravity is used to reset the gravity to its default value. See imagemagick.org/Usage/basics
– fmw42
Nov 14 '18 at 2:17
I see. Many thanks for help, explanation and info shared.
– Ger Cas
Nov 14 '18 at 2:54
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289232%2fmodify-code-to-add-top-header-imagemagick%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In ImageMagick you can create images anywhere in parenthesis and reposition them with -swap ... (or +swap for the last two). So your command would become:
coord1="98x35+234+16"
coord2="178x59+29+65"
coord3="178x59+223+65"
coord4="178x59+417+65"
coord5="178x59+611+65"
coord6="239x147+35+179"
coord7="239x147+416+179"
coord8="239x147+73+349"
coord9="239x147+401+353"
convert
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Left" )
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Right" )
-background white +smush +2 -write mpr:leftright +delete +gravity
input.png +repage -write mpr:img -delete 0--1 -background none -bordercolor "#870000"
( mpr:img -crop $coord2 )
( mpr:img -crop $coord3 )
( mpr:img -crop $coord4 )
( mpr:img -crop $coord5 )
-border 4 ( -clone 0,1 -smush -4 ) ( -clone 2,3 -smush -4 ) -delete 0-3 -gravity center +smush -4 +gravity
( mpr:img -crop $coord1 -border 4 ) +swap -gravity center -smush +12 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Five Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img1.png
( ( mpr:img -crop $coord6 +repage -border 4 ) ( mpr:img -crop $coord7 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Blue Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img2.png ) -delete 0--1
( ( mpr:img -crop $coord8 +repage -border 4 ) ( mpr:img -crop $coord9 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Green Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img3.png ) null:
And the results are:
Unfortunately, in IM 6 there is no way to know how wide your smushed colored images will be so as to make the title the same width unless you compute that ahead of time. In IM 7, it can be done in-line in your command line. So here I made it the same width as the two left right smushed images. You can change the width by changing the width value in -size 250x36.
Just great. Thanks so much one more time. I see that you didn't use "mpr" to create the top headers, then to create the Left-Right headers could be done in the same way? I mean without use mpr? Additionally what does mean-delete 0--1
and why sometimes use + or - gravity?
– Ger Cas
Nov 14 '18 at 2:11
mpr: was needed to avoid repeatedly reading your input image. -delete 0--1 means to delete all the previous image in the command sequence 0 is the first and -1 is the last. So 0--1 means from the first to the last. -gravity is needed when setting a gravity for use. +gravity is used to reset the gravity to its default value. See imagemagick.org/Usage/basics
– fmw42
Nov 14 '18 at 2:17
I see. Many thanks for help, explanation and info shared.
– Ger Cas
Nov 14 '18 at 2:54
add a comment |
In ImageMagick you can create images anywhere in parenthesis and reposition them with -swap ... (or +swap for the last two). So your command would become:
coord1="98x35+234+16"
coord2="178x59+29+65"
coord3="178x59+223+65"
coord4="178x59+417+65"
coord5="178x59+611+65"
coord6="239x147+35+179"
coord7="239x147+416+179"
coord8="239x147+73+349"
coord9="239x147+401+353"
convert
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Left" )
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Right" )
-background white +smush +2 -write mpr:leftright +delete +gravity
input.png +repage -write mpr:img -delete 0--1 -background none -bordercolor "#870000"
( mpr:img -crop $coord2 )
( mpr:img -crop $coord3 )
( mpr:img -crop $coord4 )
( mpr:img -crop $coord5 )
-border 4 ( -clone 0,1 -smush -4 ) ( -clone 2,3 -smush -4 ) -delete 0-3 -gravity center +smush -4 +gravity
( mpr:img -crop $coord1 -border 4 ) +swap -gravity center -smush +12 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Five Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img1.png
( ( mpr:img -crop $coord6 +repage -border 4 ) ( mpr:img -crop $coord7 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Blue Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img2.png ) -delete 0--1
( ( mpr:img -crop $coord8 +repage -border 4 ) ( mpr:img -crop $coord9 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Green Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img3.png ) null:
And the results are:
Unfortunately, in IM 6 there is no way to know how wide your smushed colored images will be so as to make the title the same width unless you compute that ahead of time. In IM 7, it can be done in-line in your command line. So here I made it the same width as the two left right smushed images. You can change the width by changing the width value in -size 250x36.
Just great. Thanks so much one more time. I see that you didn't use "mpr" to create the top headers, then to create the Left-Right headers could be done in the same way? I mean without use mpr? Additionally what does mean-delete 0--1
and why sometimes use + or - gravity?
– Ger Cas
Nov 14 '18 at 2:11
mpr: was needed to avoid repeatedly reading your input image. -delete 0--1 means to delete all the previous image in the command sequence 0 is the first and -1 is the last. So 0--1 means from the first to the last. -gravity is needed when setting a gravity for use. +gravity is used to reset the gravity to its default value. See imagemagick.org/Usage/basics
– fmw42
Nov 14 '18 at 2:17
I see. Many thanks for help, explanation and info shared.
– Ger Cas
Nov 14 '18 at 2:54
add a comment |
In ImageMagick you can create images anywhere in parenthesis and reposition them with -swap ... (or +swap for the last two). So your command would become:
coord1="98x35+234+16"
coord2="178x59+29+65"
coord3="178x59+223+65"
coord4="178x59+417+65"
coord5="178x59+611+65"
coord6="239x147+35+179"
coord7="239x147+416+179"
coord8="239x147+73+349"
coord9="239x147+401+353"
convert
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Left" )
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Right" )
-background white +smush +2 -write mpr:leftright +delete +gravity
input.png +repage -write mpr:img -delete 0--1 -background none -bordercolor "#870000"
( mpr:img -crop $coord2 )
( mpr:img -crop $coord3 )
( mpr:img -crop $coord4 )
( mpr:img -crop $coord5 )
-border 4 ( -clone 0,1 -smush -4 ) ( -clone 2,3 -smush -4 ) -delete 0-3 -gravity center +smush -4 +gravity
( mpr:img -crop $coord1 -border 4 ) +swap -gravity center -smush +12 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Five Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img1.png
( ( mpr:img -crop $coord6 +repage -border 4 ) ( mpr:img -crop $coord7 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Blue Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img2.png ) -delete 0--1
( ( mpr:img -crop $coord8 +repage -border 4 ) ( mpr:img -crop $coord9 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Green Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img3.png ) null:
And the results are:
Unfortunately, in IM 6 there is no way to know how wide your smushed colored images will be so as to make the title the same width unless you compute that ahead of time. In IM 7, it can be done in-line in your command line. So here I made it the same width as the two left right smushed images. You can change the width by changing the width value in -size 250x36.
In ImageMagick you can create images anywhere in parenthesis and reposition them with -swap ... (or +swap for the last two). So your command would become:
coord1="98x35+234+16"
coord2="178x59+29+65"
coord3="178x59+223+65"
coord4="178x59+417+65"
coord5="178x59+611+65"
coord6="239x147+35+179"
coord7="239x147+416+179"
coord8="239x147+73+349"
coord9="239x147+401+353"
convert
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Left" )
( -size 125x36 xc:"#00137F" -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Right" )
-background white +smush +2 -write mpr:leftright +delete +gravity
input.png +repage -write mpr:img -delete 0--1 -background none -bordercolor "#870000"
( mpr:img -crop $coord2 )
( mpr:img -crop $coord3 )
( mpr:img -crop $coord4 )
( mpr:img -crop $coord5 )
-border 4 ( -clone 0,1 -smush -4 ) ( -clone 2,3 -smush -4 ) -delete 0-3 -gravity center +smush -4 +gravity
( mpr:img -crop $coord1 -border 4 ) +swap -gravity center -smush +12 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Five Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img1.png
( ( mpr:img -crop $coord6 +repage -border 4 ) ( mpr:img -crop $coord7 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Blue Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img2.png ) -delete 0--1
( ( mpr:img -crop $coord8 +repage -border 4 ) ( mpr:img -crop $coord9 +repage -border 4 )
+smush +6 mpr:leftright +swap -gravity center -smush +11 +gravity
( -size 250x36 xc:gray -fill white -font Calibri-Bold.ttf -pointsize 32 -gravity center -annotate +0+0 "Green Boxes" )
+swap -background none -gravity center -smush +20 +gravity -write Img3.png ) null:
And the results are:
Unfortunately, in IM 6 there is no way to know how wide your smushed colored images will be so as to make the title the same width unless you compute that ahead of time. In IM 7, it can be done in-line in your command line. So here I made it the same width as the two left right smushed images. You can change the width by changing the width value in -size 250x36.
answered Nov 13 '18 at 22:45
fmw42fmw42
7,80341427
7,80341427
Just great. Thanks so much one more time. I see that you didn't use "mpr" to create the top headers, then to create the Left-Right headers could be done in the same way? I mean without use mpr? Additionally what does mean-delete 0--1
and why sometimes use + or - gravity?
– Ger Cas
Nov 14 '18 at 2:11
mpr: was needed to avoid repeatedly reading your input image. -delete 0--1 means to delete all the previous image in the command sequence 0 is the first and -1 is the last. So 0--1 means from the first to the last. -gravity is needed when setting a gravity for use. +gravity is used to reset the gravity to its default value. See imagemagick.org/Usage/basics
– fmw42
Nov 14 '18 at 2:17
I see. Many thanks for help, explanation and info shared.
– Ger Cas
Nov 14 '18 at 2:54
add a comment |
Just great. Thanks so much one more time. I see that you didn't use "mpr" to create the top headers, then to create the Left-Right headers could be done in the same way? I mean without use mpr? Additionally what does mean-delete 0--1
and why sometimes use + or - gravity?
– Ger Cas
Nov 14 '18 at 2:11
mpr: was needed to avoid repeatedly reading your input image. -delete 0--1 means to delete all the previous image in the command sequence 0 is the first and -1 is the last. So 0--1 means from the first to the last. -gravity is needed when setting a gravity for use. +gravity is used to reset the gravity to its default value. See imagemagick.org/Usage/basics
– fmw42
Nov 14 '18 at 2:17
I see. Many thanks for help, explanation and info shared.
– Ger Cas
Nov 14 '18 at 2:54
Just great. Thanks so much one more time. I see that you didn't use "mpr" to create the top headers, then to create the Left-Right headers could be done in the same way? I mean without use mpr? Additionally what does mean
-delete 0--1
and why sometimes use + or - gravity?– Ger Cas
Nov 14 '18 at 2:11
Just great. Thanks so much one more time. I see that you didn't use "mpr" to create the top headers, then to create the Left-Right headers could be done in the same way? I mean without use mpr? Additionally what does mean
-delete 0--1
and why sometimes use + or - gravity?– Ger Cas
Nov 14 '18 at 2:11
mpr: was needed to avoid repeatedly reading your input image. -delete 0--1 means to delete all the previous image in the command sequence 0 is the first and -1 is the last. So 0--1 means from the first to the last. -gravity is needed when setting a gravity for use. +gravity is used to reset the gravity to its default value. See imagemagick.org/Usage/basics
– fmw42
Nov 14 '18 at 2:17
mpr: was needed to avoid repeatedly reading your input image. -delete 0--1 means to delete all the previous image in the command sequence 0 is the first and -1 is the last. So 0--1 means from the first to the last. -gravity is needed when setting a gravity for use. +gravity is used to reset the gravity to its default value. See imagemagick.org/Usage/basics
– fmw42
Nov 14 '18 at 2:17
I see. Many thanks for help, explanation and info shared.
– Ger Cas
Nov 14 '18 at 2:54
I see. Many thanks for help, explanation and info shared.
– Ger Cas
Nov 14 '18 at 2:54
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289232%2fmodify-code-to-add-top-header-imagemagick%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown