Uniting different commands in a single one

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Uniting different commands in a single one

Post by javismiles »

is the example in "I have uploaded this example in IM Examples, Text Handling, Form Filling
http://www.imagemagick.org/Usage/text/#form_filling"

cant find it so far
thank you :)
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Uniting different commands in a single one

Post by javismiles »

looking at the code below
the part that i have problems to pass to php is just this one

"miff:-
done |
convert "

is 'done' the end of the loop? is the pipe | the link between the loop and the next convert statement? and if so, how can we execute that from an scripting language like php?

i understand the miff format, and the function of the pipe, it seems you are looping creating each text and putting them in memory, miff, thats great,
and then you flatten them all and onto a large background png, i just dont clearly see, do you first loop creating each text and then when - done - , you pipe it all to the final convert that flattens?
or am i missing something else?

and how do we do that pipe, i mean, is this a single command? cannot be if there is a loop, if there is a loop it cannot be a single command in php

cat text_data.txt |
while read width gravity color pointsize x y text
do
convert -size ${width}x -gravity $gravity -fill $color -background wheat \
-pointsize $pointsize -page +${x}+${y} label:"${text}" miff:-
done |
convert -size 200x100 xc: - -flatten text_layered.png
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Uniting different commands in a single one

Post by anthony »

It is just a repeat of the initial while loop pipeline. It will appear soon.

However you can not simply mix PHP and shell. PHP has no real concept of pipelines, shell does.

The example opened a command to which it can then print the 'text data' into that command for the shell 'read' command to read.

I think you will need to look at more PHP to Shell interaction examples somewhere. If you find a good guide, please let me know.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Uniting different commands in a single one

Post by javismiles »

i see, mmm
well, then it seems to me that the pipes cannot be translated into php, and probably each shell pipe means a new command in php i guess
if i find anything about this for sure i will let u know, i hope i find something around :)

the pity is that if there was a justification tag , all of this would be so easy,
the examples we posted in the morning worked all perfect, in 1 single command, except that imagemagick was confusing the local justification of
the texts with the global gravity relative to the background, if it wasnt for that it would be so easy,
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Uniting different commands in a single one

Post by anthony »

one shell command, containing the while loop and pipeline, with a data feed.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Uniting different commands in a single one

Post by javismiles »

yeah thats on the shell, the question is how to replicate that with php code and still one single command

we know how to do it also in php with one single command, but it breaks because imagemagick confuses local justification with the global one,
anyways, they have to make justification and gravity independent of each other, honestly thats quite obviously necessary for quite a few uses
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Uniting different commands in a single one

Post by javismiles »

which reminds me,

this issue of justification and gravity not being separated, does this happen only in imagemagick? or is this generic all around?

thank you again for all your help and tips and all :) and thank you to imagemagick, its so very useful in so many ways
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Uniting different commands in a single one

Post by anthony »

Graphics Magick was a fork of IM from IM v5 it is missing a LOT of the stuff that has been added to IM. As such I would not be surprised if it is missing from it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply