Dear forum-users, is it possible to draw a black line, dividing an image? I need to draw a black line between pages to make Scan Talor recognize that file consists of two pages.
Debeo scriptvm, qvod cognoscit, si pagina duas paginas inclvdit. Si inclvdit, scriptvm has paginas una linea nigra dividit. Alteri applicationi interest, ut linea nigra sit.
Уважаемые форумчане, возможно ли нарисовать черную линию, разделяющую картинку на две части? Это необходимо для дальнейшей работы в Scan Tailor.
Black line / linea nigra / черная линия
-
- Posts: 24
- Joined: 2011-03-21T09:27:47-07:00
- Authentication code: 8675308
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Black line / linea nigra / черная линия
see -draw "line x1,y1 x2,y2" http://www.imagemagick.org/Usage/draw/#primitives
convert inputimage -stroke black -stroke-width 1 -draw "line x1,y1 x2,y2" resultimage
convert inputimage -stroke black -stroke-width 1 -draw "line x1,y1 x2,y2" resultimage
-
- Posts: 24
- Joined: 2011-03-21T09:27:47-07:00
- Authentication code: 8675308
Re: Black line / linea nigra / черная линия
Is it possible to get image size to know where to draw line? It seems that x1=1, y1=height/2, x2=width, y2=height/2.fmw42 wrote:see -draw "line x1,y1 x2,y2" http://www.imagemagick.org/Usage/draw/#primitives
convert inputimage -stroke black -stroke-width 1 -draw "line x1,y1 x2,y2" resultimage
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Black line / linea nigra / черная линия
On Linux/Mac,Is it possible to get image size to know where to draw line? It seems that x1=1, y1=height/2, x2=width, y2=height/2.
ww=`convert image -ping -format "%[fx:w-1]" info:`
hh=`convert image -ping -format "%[fx:h/2]" info:`
convert inputimage -stroke black -draw "line 0,$hh $ww,$hh" resultimage
see -string format and -fx escapes
http://www.imagemagick.org/script/escape.php
http://www.imagemagick.org/Usage/transform/#fx_escapes
I don't believe that -draw allows calculation within its arguments. But I could be wrong.
For Windows, see http://www.imagemagick.org/Usage/windows/
Last edited by fmw42 on 2011-03-27T15:34:52-07:00, edited 1 time in total.
-
- Posts: 24
- Joined: 2011-03-21T09:27:47-07:00
- Authentication code: 8675308
Re: Black line / linea nigra / черная линия
I mean that what you've said. I've already decided this problem in a such way:
SZX=$(identify -format "%w" "$IMG")
SZY=$((SZY=$(identify -format "%h" "$IMG") / 2))
convert "$IMG" -white-threshold 75% -stroke black -strokewidth 10 -draw "line 1,$SZY $SZX,"$SZY"" "$IMG"
But your way is much easer. Thanks!
SZX=$(identify -format "%w" "$IMG")
SZY=$((SZY=$(identify -format "%h" "$IMG") / 2))
convert "$IMG" -white-threshold 75% -stroke black -strokewidth 10 -draw "line 1,$SZY $SZX,"$SZY"" "$IMG"
But your way is much easer. Thanks!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Black line / linea nigra / черная линия
You can also do:
coords=`convert inputimage -ping -format "0,%[fx:h/2] %[fx:w-1],%[fx:h/2]" info:`
convert inputimage -stroke black -draw "line $coords" resultimage
or
coords=$(convert inputimage -ping -format "0,%[fx:h/2] %[fx:w-1],%[fx:h/2]" info:)
convert inputimage -stroke black -draw "line $coords" resultimage
coords=`convert inputimage -ping -format "0,%[fx:h/2] %[fx:w-1],%[fx:h/2]" info:`
convert inputimage -stroke black -draw "line $coords" resultimage
or
coords=$(convert inputimage -ping -format "0,%[fx:h/2] %[fx:w-1],%[fx:h/2]" info:)
convert inputimage -stroke black -draw "line $coords" resultimage
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Black line / linea nigra / черная линия
Your not. At least not at this time. This may change, but at this time Percent escapes are not permitted by 'Draw'fmw42 wrote:I don't believe that -draw allows calculation within its arguments. But I could be wrong.
arguments.
NOTE in the example image the center of the image is not the center of the book!
And finally you can draw beyond the image bounds, if that make things easier. Anything outsid ethe image proper is just ignored. As such you don't really have to worry about using %[fx:w-1] when %w will work just as well.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/