0

I have a png image that I generated from a cad drawing using edge-detection. Only problem is all the lines have the same thickness. The lines that mark the main edges I need to be thicker and more prominent. But, I also have shading-type lines in the same drawing, that I do not want to be any thicker, as then they would merge together.

I am using imagemagick, and using -morphology dilate disk:2 worked to make all the lines thicker. However, now the shading lines are too thick and they merged into a blob.

How can I thicken only the lines that are not the shading lines? I'm thinking that the shading lines may be identifiable by their proximity to each other. Maybe I could use that as a metric to create a mask that can identify the not-shading lines for thickening. Does this sound like it could work, or is there some other suggestion? If so, how could this be done using imagemagick (or similar)?


EDIT:

I made a sample model to demonstrate the effects that I've described.

First, here is the line drawing without darkening (so thinner lines) (made from imagemagick's edge-detection of the exported png):

undarkened line drawing

And second, here is the line drawing with darkening (so thicker lines) (the previous one but with an additional -morphology dilate disk:2 step).

darkened line drawing

The first drawing is too faint, it hurts my eyes to look at. The second one is pretty good, almost good enough, but the shading lines (on the two crossed cylinders) are too prominent, I think. I thought I might be able to get the best of both worlds by darkening only the non-shading lines.

13
  • 1
    It would help to see the image in question. But just reading your description it sounds a bit far fetched. You might be able to get close, but then you'll probably have some places where the method fails. Where lines meet for example. It would be so much easier to work with the original working file first or an exported vector file if that's possible.
    – Wolff
    Feb 16 at 16:18
  • 1
    Well, it's not a standard way of working. More like a hack. So if it could be done really depends on how the image looks. If it's a really simple image, you could do something like this in Photoshop (or similar program). But if thick and thin lines meet in many different ways I can't see how the software should be able to understand the difference.
    – Wolff
    Feb 16 at 17:27
  • 1
    Need to see something to be honest. If you can't share the specific image, then something similar would be fine. But there is nothing that can do what you want really. To make different lines darker you would need to select those parts if the image, and apply something like a levels adjustment. Raster software like GIMP or imagemagick have no way of knowing how close one line is to another.
    – Billy Kerr
    Feb 16 at 17:29
  • 2
    @Wolff - yes there could be ways/hacks to try to separate the different lines in some way, but it's not going to be easy. Even harder to make suggestions with nothing to see.
    – Billy Kerr
    Feb 16 at 17:36
  • 2
    If you could export an image with shading lines and another image without them, you could make the lines thicker on the latter and combine it with the first. Probably using blend mode "multiply" would be fine.
    – Wolff
    Feb 16 at 17:40

0

Your Answer

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

Browse other questions tagged or ask your own question.