2

Summary

For pen plotting, I would like to transform an image into many parallel lines. Depending on how dark a spot in an image is, the parallel lines are more or less densely packed.

Current Approach

Example prior image from Piotr Siedlecki (CC0 Public Domain) Piotr Siedlecki (CC0 Public Domain) skull full

As-is transformation Gaussian Blur --> Posterize (3 Colors)

enter image description here

--> select each color (white, grey, black) and put them into their own layers

--> in every layer, select the color to get the outline

--> deleted the selection contents so you only have the selection outline

--> painted it with a paint brush with a parallel-line-brush

enter image description here

Question

How to do this in less ugly? Currently, both the result and the workflow are ugly.

Are there good search terms to search this technique? Maybe some tools, instead? I found halftone to be ALMOST the term I am looking for, but I would like to get lines, not dots.

Available tools:

Photoshop, Illustrator, GIMP, Inkscape, Python

Related:

  1. Related thread with parallel, equidistant lines with varying thickness. I would like parallel lines with equal thickness, where the distance between each line varies. How can I create a halftone using rough lines?

  2. A super cool project using flow vectorization with a Python package which does not work for me https://www.csun.io/2021/12/29/plotting-old-pictures.html

3
  • 2
    Sources of the ugliness 1) too few greyshades to present the shading of the curved surface. Wood and metal carvers fixed it by drawing the lines as the images of the geodetic lines on the surface; a few greyshades were enough. 2) Horizontal lines fight with the display raster. It's called interference -lines seem to vanish and their apparent widths vary. Here's a version with 5 grays. It's zoomed in to avoid interference i.sstatic.net/zfNog.png Check this old case, too graphicdesign.stackexchange.com/questions/99785/…
    – user82991
    Commented Jul 27, 2022 at 0:26
  • Thank you for the tips and sources provided! May I ask which tool you used to make that skull? Commented Jul 27, 2022 at 12:24
  • 1
    The skull is your attached one. I tried to reduce its noisiness and adjust its grayscale in Photoshop so that 5 grays could show enough of the forms. The result was traced in Illustrator and the different grays were replaced with my quickly drawn parallel line pattern swatches that you can see in my image. This contains nothing clever nor optimal. I'll add an answer if nobody shows anything more advanced today.
    – user82991
    Commented Jul 27, 2022 at 15:33

2 Answers 2

2

Seemingly no advanced methods presented in 2 days after the question. Also I would like to see for ex. a plugin or script which does the job perfectly with low effort and preferably gives so many greyshades that the shading caused by the 3D form of the skull is well reproduced. I have seen as ready to use software only methods which vary line widths or dot sizes for half-toning. None of them was able to vary the density of constant width parallel lines. When waiting for it you get an answer which applies Photoshop's and Illustrator's basic functions in a straightforward way.

Your attached skull image has white as well on the skull and background. It's useful to darken the skull a little to let the white present only the background. There's also another reason to preprocess the photo in Photoshop. The easy method to convert greyshades to line densities that I know allows only a limited amount of different greys. The greyscale of the photo must be adjusted and the result must be posterized so that the curved form is presented well enough with the limited number of greys. Here's one attempt:

enter image description here

There's a layer mask (a converted selection) to keep the background white. On the top there's adjustment layer Posterize to 7 colors. The greyscale is modified with curves layer so that the shading looks plausible with black, white and 5 greys between them.

The result has harmfully much small details. They cannot be presented as line densities better than as a dot. It can be useful to filter out small details in Photoshop to have simpler image in Illustrator. Illustrator fortunately has a possibility to ignore too small areas. We skip filtering (=Median and Cutout)in Photoshop and check at first what Illustrator gives.

In Photoshop we duplicate the layers and merge the duplicates to get a single layer, but to also keep the separate layers because some tweaks mey be needed. We copy and paste the merged version to Illustrator for tracing.

In Illustrator we duplicate the image to be able to see in the preview how well the tracing succeeds:

enter image description here

In the left there's the duplicate of the image and in the right there's the preview of geyscale tracing. We had to lift the number of the greyshades to 9 before Illustrator found all of our 6 non-white greyshades. White is ignored, the minimum area is lifted to 50 px and as much as 8 px inaccuracy is allowed. The statistics in the tracing dialog tells that there's 6 colors, hundreds of paths and thousands of nodes. It's not at all a simple. The preview looks for me acceptable, so we expand the tracing result:

enter image description here

To make it easier to handle we ungroup the result. Then we select at first one of the lightest shapes, select all of the same color by applying Select > Same > Fill color and combine them to one by applying Pathfinder panel's Unite. Pathfinder actually only groups the selected shapes because they are not adjacent. In the same way we create one group for all 6 greyshades:

enter image description here

The image is the same as above, but the object list in the Layers panel contains only 6 groups. The group of blacks is now selected.

The image is ready to be half-toned. We can fill the areas with line patterns. Any line patterns can be used. I have used in older cases lines which have constant density, but varying widths. It was here: Create engraving in GIMP/Inkscape You wanted horizontal lines with constant line width, but varying line density.

You could prepare 6 whole image sized line patterns and use the groups as clipping masks to them. In Illustrator one may want to use custom pattern swatches as fill colors.Unfortunately having strokes in pattern swatches are tricky; Illustrator generates unwanted slight gaps and I have still not found a way to work around it. The gaps are well visible in my version given in a comment above: https://i.sstatic.net/zfNog.png

It's possible the gaps are caused by a bug in the legacy Illustrator I use and it can be non-existent in modern Illustrator versions. Filled line-like areas - in your case wide, but low rectangles - work better.

The lines must be narrow enough to be able to to present small enough details, so finding a good swatch pattern square size and line width (rectangle height) is anything but trivial. We cannot do any optimization calculations based on advanced models of visual recognition processes, we can only apply the trial and error -method to find something acceptable.

We have also an opponent: The display. Tightly spaced lines interfere easily with the display pixel grid. That's known as Moire effect. You wanted horizontal lines which make the problem as bad as possible.

But let's stop worrying our poor ability to take everything into the account. The skull in my image is scaled to be 120 millimeters high. 1x1 millimeter pixels seem to be able to present the differently colored areas recognizably as the next image shows (scaled to 120 px high in Photoshop with nearest neighbour resampling, undone after seeing the result):

enter image description here

I tried also it as 90 px high, but the teeth vanished. So let's have our fill patterns made of 1 x 1 millimeters squares. That can be much more than what's actually needed, because the parallel horizontal line half-toning has limited resolution only in the vertical direction, the horizontal resolution stays the same as in the original image and that helps the recognition.

The final greyscale is problematic. The lightest areas should have one line per vertical millimeter. The 2nd light color must have 2 lines per millimeter, it simply cannot be proportionally more because our resolution element was 1 mm high. Respectively the next darker greyshade must have 3 lines etc... The darkest (full black) part should have 6 lines and that should define the line width. It should be 1/6 (about 0,167) millimeters.

My preliminary tests revealed that solid black looks wrong. Some lines should be visible also in the darkest areas. And the white gap between the lines should be also visible. The lines can be only about 0,1 mm wide to leave some visible gaps.

Common computer displays have say 0,2 or 0,25 millimeters high pixels which simply cannot show properly 1/6 nor 0,1 millimeter wide lines. The image becomes impossible to be shown properly on usual displays without substantial zoom in. The only solution is to use a less dense halftoning which works better on displays. It doesn't spoil the recognizability if the less dense half toning method is effective enough or one uses simple enough image.

But you asked parallel horizontal lines, so you get them, no matter you can see maybe only a quarter of the skull properly at a time.

I prepared 1x1 millimeters squares which have 1,2,3,4,5 and 6 lines. The lines are actually 0,1 millimeters high black rectangles. The gaps between the rectangles are calculated with Excel:

enter image description here

A = the side length of the square, 1 means 1 millimeter. W means the line width. G, the gap between the lines has formula G=(A/N)-W.

There's a light grey 1 x 1 millimeters square as the base of the resolution element. I drew a G-high rectangle to be used a snapping guide to get the line spacings right. The base square must be kept there to make the elements exactly 1 mm high. No misaligment is allowed, one MUST know how to use point snapping, smart guides and shape alignment.

The patterns are draggedt to the swatches collection and applied to the different color groups:

The next screenshot shows how the display interferes with the image:

enter image description here

Zoom in version is better, but there's still line width variations:

enter image description here

More zoom in shows that all lines really are there:

enter image description here

If it must be visible on the screen as a whole with low interference, we can try to reduce the resolution by making the pattern swatch shapes bigger. It's easy in Illustrator. Select all, apply Object > Transform > Scale > Only patterns > 300% uniformly That scales lines substantially wider than the screen pixel if we also zoom in as much as the screen allows:

enter image description here

It's not as bad as one could expect, because there's still all horizontal resolution of the original image left. The used line halftoning and scaling reduce only the vertical resolution.

You can fade the grey on the background either by changing it white or transparent before dragging the patterns to the swatches or afterwards by selecting all and recoloring the artwork.

As said, this method can be seen as a sample of bovine work. Hopefully we can see something more clever from others.

2
  • Thank you for your great reply. May I inquire how the Median --> Simplify works to reduce the small details? Commented Jul 31, 2022 at 20:24
  • Hoh! You found an error. Simplify is taken from elsewhere than Photoshop. The filterings should be Median and Cutout in this answer. I fixed them. In the next image Filter > Noise > Median is applied in the left, in the middle there's no filtering and in the right there's Filter > Artistic > Cutout. i.sstatic.net/0iI6c.png Only the skull area is filtered, there was a selection (by quick selection tool) for it.
    – user82991
    Commented Jul 31, 2022 at 20:51
2

If you simply want something quick and easy (and raster)...

AlphaPlugins offers Engraver II for Photoshop. This can somewhat be done quickly with their plug in...
(Note: I have no affiliation with AlphaPlugins.)

First invert the original image via Image > Adjustments > Invert
(I removed the white background here as well)...

enter image description here

The result is white...

enter image description here

Simply invert again...

enter image description here


If you want precision (or vector)....

Here's what I'd do...

Be aware.. By no means an I suggesting this is a "quick" or "easy" method. This takes manual effort and time to get correct.

First place the original in Illustrator, merely to use as a guide, and lock the layer. (Any vector app will work.)

Draw a simple line grid on a new layer above the image. This grid will be the lightest shade of grey in the image, i.e. shade 1...

enter image description here

Adjust path ends to match shape...

enter image description here

This created the "base" tone - or the lightest shade after white.

Remove portions to achieve white areas (I used the Eraser Tool in Illustrator - meaning I just selected the paths, and "brushed" over areas I wanted to remove.)

enter image description here

Select all the paths, and duplicate them while also offsetting them half the distance between the existing paths. Keep these duplicates selected. And again remove portions from these offset paths, but this time leave paths in areas you want slightly darker than the previous areas... this would be shade 2.

enter image description here

Repeat.. duplicate paths, offsetting them, keep selected, and remove portions...

enter image description here

Keep repeating until you are happy with the contract and tonal variations.

enter image description here

enter image description here

I only did 3 steps above and you can start to see some definition. All the paths are just parallel 1pt black strokes. Thinner strokes and more steps will create more definition. I also wasn't overly precise when removing paths.. the more precision you use the better the end result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.