Page 1 of 1
import -annotate question
Posted: 2008-06-05T18:19:40-07:00
by ktenney
Howdy,
I want to put text on a screen grab, the doc seems to say that
$ import -annotate 10,10 "pasted text" anno.png
should put text onto anno.png
I haven't been able to get it to work.
What am I missing?
Thanks,
Kent
Re: import -annotate question
Posted: 2008-06-05T23:59:30-07:00
by Bonzo
Should -annotate 10,10 be -annotate +10+10
Re: import -annotate question
Posted: 2008-06-06T03:57:22-07:00
by ktenney
Bonzo wrote:Should -annotate 10,10 be -annotate +10+10
That doesn't work either.
I've searched a fair amount and not found any example of using
'import' with '-annotate'
Re: import -annotate question
Posted: 2008-06-08T11:24:31-07:00
by ktenney
ktenney wrote:Bonzo wrote:Should -annotate 10,10 be -annotate +10+10
That doesn't work either.
I've searched a fair amount and not found any example of using
'import' with '-annotate'
It seems that the coordinates passed to -annotate are of the
screen itself, so If I grab an image of the top left part of the
screen I can see the annotation text.
Any idea whether coordinates could be relative to the image
grabbed by 'import' ?
Thanks,
Kent
Re: import -annotate question
Posted: 2008-06-08T15:15:45-07:00
by fmw42
I don't see any import function in IM?
Re: import -annotate question
Posted: 2008-06-09T20:21:24-07:00
by anthony
Its a command simular to reading from image format x:
Try this
convert x: -annotate +10+10 "pasted text" anno.png
Re: import -annotate question
Posted: 2008-06-10T06:56:30-07:00
by ktenney
anthony wrote:Its a command simular to reading from image format x:
Try this
convert x: -annotate +10+10 "pasted text" anno.png
Did that work for you?
I'm getting the same thing, the pasted text only appears if I'm
grabbing the top left corner of the screen.
I'll next try chaining operations, grabbing first, then annotating.
Does that sound right?
Thanks,
Kent
Re: import -annotate question
Posted: 2008-06-10T16:30:45-07:00
by anthony
The annotation appear in the grabbed window image for BOTH "import" and the "convert x:" versions for me. No problem.
By default using either method arranged for the mouse to select the window to grab.
For a specific window titled "mage" (a black xterm so I changed the text color)
Code: Select all
convert x:mage -fill white -annotate +10+10 "pasted text" anno.png
the text also appeared, without any problems.
NOTE: -fill is NOT available in "import"
Re: import -annotate question
Posted: 2008-06-11T05:18:39-07:00
by ktenney
anthony wrote:The annotation appear in the grabbed window image for BOTH "import" and the "convert x:" versions for me. No problem.
By default using either method arranged for the mouse to select the window to grab.
For a specific window titled "mage" (a black xterm so I changed the text color)
Code: Select all
convert x:mage -fill white -annotate +10+10 "pasted text" anno.png
the text also appeared, without any problems.
NOTE: -fill is NOT available in "import"
Ah, I am not grabbing a window, but doing click and drag to select
an area of the screen.
Does it require 2 steps to annotate a screen grab if using a selection
instead of the entire window?
Thanks,
Kent
Re: import -annotate question
Posted: 2008-06-11T17:17:56-07:00
by anthony
Okay then. a dragged selection....
Hmmmm
x: X 275x230 1600x1200+383+227 16-bit DirectClass
Okay a image read from a dragged selection returns an image with a virtual canvas and offset relative to the whole screen. But as
-annotate draws things relative to the virtual canvas, it will end up drawing somewhere OFF the image selected.
Solution 1: If you use
-draw instead of
-annotate, then it will draw things relative to the actual image. This will also preserve the virtual information of the 'grab'.
Code: Select all
convert x: -fill black -draw 'text 10,10 "pasted text"' anno.png
Solution 2: Junk the virtual canvas size and offset before using
-annotate.
Code: Select all
convert x: +repage -fill black -annotate +10+10 "pasted text" anno.png
You can also output the grab information if you want by saving to a separate file...
Code: Select all
convert x: -format '%wx%h%O' -identify +repage -fill black -annotate +10+10 "pasted text" anno.png >anno_offset.txt
Adding this info to IM Examples under "import"
http://imagemagick.org/Usage/basics/#import
and the special "x:" file format
http://imagemagick.org/Usage/files/#x
Re: import -annotate question
Posted: 2008-06-12T05:19:50-07:00
by ktenney
The first one still writes to screen coordinates for me,
the other 2 are exactly what I hoped for, great stuff!
Thanks,
Kent
Re: import -annotate question
Posted: 2008-06-12T16:32:23-07:00
by anthony
You are right. However my understanding was that -draw ignored the virtual canvas (real image coordinates), while -annotate didn't (virtual image coordinates).
For example this does the right thing...
Code: Select all
convert x: -fill black -draw 'circle 35,35 20,30' circle_grab.png
As such we have an inconsistency been these two draw MVG primitives.
this probably should be reported as a bug.