import -annotate question
import -annotate question
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
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
Should -annotate 10,10 be -annotate +10+10
Re: import -annotate question
That doesn't work either.Bonzo wrote:Should -annotate 10,10 be -annotate +10+10
I've searched a fair amount and not found any example of using
'import' with '-annotate'
Re: import -annotate question
ktenney wrote:That doesn't work either.Bonzo wrote:Should -annotate 10,10 be -annotate +10+10
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: import -annotate question
Its a command simular to reading from image format x:
Try this
convert x: -annotate +10+10 "pasted text" anno.png
Try this
convert x: -annotate +10+10 "pasted text" anno.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: import -annotate question
Did that work for you?anthony wrote:Its a command simular to reading from image format x:
Try this
convert x: -annotate +10+10 "pasted text" anno.png
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: import -annotate question
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)
the text also appeared, without any problems.
NOTE: -fill is NOT available in "import"
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
NOTE: -fill is NOT available in "import"
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: import -annotate question
Ah, I am not grabbing a window, but doing click and drag to selectanthony 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)the text also appeared, without any problems.Code: Select all
convert x:mage -fill white -annotate +10+10 "pasted text" anno.png
NOTE: -fill is NOT available in "import"
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: import -annotate question
Okay then. a dragged selection....
Hmmmm
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'.
Solution 2: Junk the virtual canvas size and offset before using -annotate.
You can also output the grab information if you want by saving to a separate file...
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
Hmmmm
Code: Select all
convert x: info:
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.x: X 275x230 1600x1200+383+227 16-bit DirectClass
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
Code: Select all
convert x: +repage -fill black -annotate +10+10 "pasted text" anno.png
Code: Select all
convert x: -format '%wx%h%O' -identify +repage -fill black -annotate +10+10 "pasted text" anno.png >anno_offset.txt
http://imagemagick.org/Usage/basics/#import
and the special "x:" file format
http://imagemagick.org/Usage/files/#x
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: import -annotate question
The first one still writes to screen coordinates for me,
the other 2 are exactly what I hoped for, great stuff!
Thanks,
Kent
the other 2 are exactly what I hoped for, great stuff!
Thanks,
Kent
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: import -annotate question
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...
As such we have an inconsistency been these two draw MVG primitives.
this probably should be reported as a bug.
For example this does the right thing...
Code: Select all
convert x: -fill black -draw 'circle 35,35 20,30' circle_grab.png
this probably should be reported as a bug.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/