Halftones - anyone solved this one?

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
User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Looks like you need to first convert the image into the appropriate number of greyscale levels.

One method is given in
http://www.cit.gu.edu.au/~anthony/graph ... #color_lut
You can grey the image as well and level the gradient using

Code: Select all

-fx 'floor(intensity*11)/10'
Then you want to replace each grey level with a tile of the appropriate halftone for that grey level.

See IM Examples color replacement (still raw notes) using -draw color replace to replace the color with a tile image
http://www.cit.gu.edu.au/~anthony/graph ... #floodfill

You can also try using some ordered dithers, as was exampled in GIF transparency handling for non-specific backgrounds..
http://www.cit.gu.edu.au/~anthony/graph ... ts/#dither

By taking an ordered dither, bluring and then thresholding, you can get a pretty reasonable faked halftone screen.

Do you have other halftone screen images such as the one you gave at other scales? These may be useful for a later section on halftones in the
Color IM Examples page.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

And please let the rest of us know exactly how it went, and what commands you ended up using. I would like to add a halftoning method to the
monocrome color reduction area of IM examples (currently in development).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Of course the half tone screen will be 'dots' like that as it is limited to on and off pixels.

Hmm lit looks very much like the -ordered-dither function of IM however that only has a mazimum of a 4x4 pixel 'square', and is not very hafltone-like.

Run this to see the -ordered-dither pattern

Code: Select all

convert -size 4x4 gradient: -scale 64x64 \
       -ordered-dither 4x4 -scale 256x256 miff:- | display - 
As you can see it isn't a half-tone like screen, but with some way of feeding a ordered dither pattern, it could be made to be a half-tone pattern. perhaps a future -ordered-dither 8x8 function!

Currently the only reference to this in IM examples is
GIFs for non-specific backgrounds
http://www.cit.gu.edu.au/~anthony/graph ... ts/#dither
But I am planing a full overview in the 'Colors' section, as I get time for it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Post by glennrp »

I've extended the "-ordered-dither" option to provide some half-tone-like
patterns. It will be available in ImageMagick-6.2.8-6 (beta) tomorrow.

The new options are 2x1, 4x1, 6x1, and 8x1.

Glenn

User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Thanks Glen
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

If you can rotate the halftone images (one for each grey level)
so that you can generate an appropriate overlay tile, then you can still do it.

EG: take a halftone tile and tile it to cover a large area than the
original image, rotate it, crop it so the rotated image halftone screen can cover the original image, now use it as the tile to replace that specific
grey level in the image. Repeat for the other half-tones.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

Post Reply