Built In Checkerboard WHITE/Gray instead of Gray/Darker Gray

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?".
Post Reply
dfelder
Posts: 42
Joined: 2011-02-25T16:49:09-07:00
Authentication code: 8675308

Built In Checkerboard WHITE/Gray instead of Gray/Darker Gray

Post by dfelder »

The built in checkerboard feature is great; however, the two colors are Gray and Darker Gray. For the highest contrast, Gray/White (or Black/White) would be preferred (like PhotoShop).

Is there a way to change this built-in pattern? I changed the checkerboard.png file in the Patterns folder, but that didn't do the trick.

Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Built In Checkerboard WHITE/Gray instead of Gray/Darker

Post by fmw42 »

why not use the checkerboard as is and stretch the contrast using -level or -auto-level

convert -size 100x100 pattern:checkerboard -auto-level checker_black_white.gif

or

convert -size 100x100 pattern:checkerboard -level 25,75% checker_level25x75.gif
dfelder
Posts: 42
Joined: 2011-02-25T16:49:09-07:00
Authentication code: 8675308

Re: Built In Checkerboard WHITE/Gray instead of Gray/Darker

Post by dfelder »

The problem is that I'm layering it below a PNG image with transparencies, so i'm using the built in to facilitate the layering.

objMi.Composite "-compose", "Dst_Over", "-tile", "pattern:checkerboard", myimagename, myimagename

That's why I wanted to use a slightly different checkerboard to show the highest possible contrast when I thumbnail it.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Built In Checkerboard WHITE/Gray instead of Gray/Darker

Post by fmw42 »

just create the checkerboard with contrast and save it as a temporary image, then use it in your composite. you can tile with any image.
dfelder
Posts: 42
Joined: 2011-02-25T16:49:09-07:00
Authentication code: 8675308

Re: Built In Checkerboard WHITE/Gray instead of Gray/Darker

Post by dfelder »

For a guy like me, it's easier said than done. LOL.

It took me a really long time to figure out how to add a stroke to an image, but I just got it all together. My solution is posted here: viewtopic.php?f=1&t=18307&p=70413#p70413

Final Solution:

Code: Select all

     objMi.Convert -size 100x100 pattern:checkerboard -auto-level checker_black_white.gif

     objMi.Composite "-compose", "Dst_Over", "-tile", "checker_black_white.gif", myimagename, myimagename
THANKS!!!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Built In Checkerboard WHITE/Gray instead of Gray/Darker

Post by anthony »

First checkerboard re-coloring. is as fred describes. normalize (auto-level) it first the use +level or +level-colors to re-color it as you like...

Code: Select all

  convert -size 60x60 pattern:checkerboard -auto-level \
          +level-colors red,blue     pattern_color_checks.gif
Image

this is from Tiling, Modifying Built-in IM Patterns/Tiles
http://www.imagemagick.org/Usage/canvas/#pattern

The other problem is if you don;t want to read the tile from a disk file.
There are three solutions. MPR, clone-append, and distort
See Tiling with an Image already In Memory
http://www.imagemagick.org/Usage/canvas/#tile_memory

The first fits with using -tile the last generates canvases using tile (or distorted tiles) :-)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Built In Checkerboard WHITE/Gray instead of Gray/Darker

Post by fmw42 »

With Anthony's technique you can set the graylevels to anything you want (100 % white and 75% black, ie 25% white)

convert -size 60x60 pattern:checkerboard -auto-level \
+level 25,100% pattern_white_gray_checks.gif
Post Reply