Page 1 of 1

Re: filling squares on chess board

Posted: 2012-03-08T23:15:21-07:00
by manit
here is my script

Code: Select all

#we will draw 50 pixel squares on a white paper 
convert -size 800x600 xc:white board.jpg

#drawing board
convert.exe board.jpg -fill white -stroke black -draw " path 'M 200,100  l 400,0 l 0,400 l -400,0 l 0,-400' " square.jpg

# draw vertical lines over previously generated
magick-convert.exe square.jpg -fill white -stroke black -draw " path 'M 250,100 l 0,400 m 50,0 l 0,-400 m 50,0 l 0,400 m 50,0 l 0,-400 m 50,0 l 0,400 m 50,0 l 0,-400 m 50,0 l 0,400 ' " vertical.jpg

#draw horizontal lines over previously generated
convert.exe vertical.jpg -fill white -stroke black -draw " path  'M 200,150 l 400,0 m 0,50 l -400,0 m  0,50 l 400,0 m 0,50 l -400,0 m 0,50 l 400,0 m 0,50 l -400,0 m 0,50 l 400,0 ' " vert-horiz.jpg
Also I wonder when I choose output file as something.svg & open it in in web browser .
It shows me the text commands not the image intended .

Re: filling squares on chess board

Posted: 2012-03-09T00:29:23-07:00
by anthony
You you need to fill in an existing image?

the "checkerboard" pattern has 15x15 pixel squares, create one the right size and enlarge.
Or even easier use "the "gray50" hash pattern (1x1 pixel hash)

Code: Select all

convert -size 8x8 pattern:gray50 -scale 5000%  chessboard.png
However the bottom right square should be white (mnemonic: white is right) so negate it (before enlarging)

Code: Select all

convert -size 8x8 pattern:gray50 -negate -scale 5000% chessboard.png
If you like other colors use +level-color
See Level Adjustment by Color
http://www.imagemagick.org/Usage/color_ ... vel-colors

Or if you want a checkerboard pattern of images, you can look at using the 'CheckerTile' virtual-pixel method to generate it...
http://www.imagemagick.org/Usage/misc/#checker_tile

Re: filling squares on chess board

Posted: 2012-03-09T02:17:44-07:00
by manit
Using checkerboard pattern yielded good result .
Also I noticed that if I save images in bmp format (bulky) then colour filling using mspaint is nice except the edge of board has an inner grey edge .
See attached image.(There ain't any image uploading in posting . I have to point to temporary locations . Later , image will disapear .)
Image
Stroke width as 1 pixel did not remove that hair gray line around edge of board.

Re: filling squares on chess board

Posted: 2012-03-09T06:22:23-07:00
by anthony
The images generated by my commands would be perfectly pure black and white. If you used -resize rather than -scale then you may not get a pure result.

Perhaps saving it to BMP format resulted in some image distortion. I have no idea why, I thought the format would not be 'lossy. But then I don't use that format, but then I am not a windows user either.

If you wanted a one pixel black border , add -bordercolor black -border 1 just before the save to PNG