0

I have used a series of CLI statements to take any (simple) picture to a printable dxf file.

I have used a mixture of ImageMagick and potrace to get this to work as I like, however, I would like to combine this all into one process, whether that be through a python library or some other language?

What I have done so far: original oddish

magick convert oddish.bmp -colorspace gray oddishBW.bmp

oddish black and white

magick convert oddishBW.bmp -negate oddishBwB.bmp

oddish black and white inverted

magick convert oddishBwB.bmp -morphology dilate Disk oddishBWBD.bmp

oddish black and white inverted with thicker lines

magick convert oddishBwBD.bmp -negate oddishbwbdw.bmp

oddish with thicker lines inverted to normal

potrace --svg oddishbwbdw.bmp -o oddishbwbdw.svg

final svg of oddish

Name explanations:

bw is standing for black and white bwb is black white black (negate makes the colors opposite) bwbd is black white black dilate (for increasing line thickness)

In addition: I realize the python libraries for imagemagickpython haven't been updated for a long time and don't include morphology features?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
  • The current Python Wand 0.5.7 is very up to date and does include morphology. See http://docs.wand-py.org/en/0.5.7/. Note that when using Imagemagick 7, use magick, not magick convert. The combination of magick with convert produces Imagemagick 6 behavior rather than that of Imagemagick 7. All your Imagemagick commands can be done in one command line to save reading and writing intermediate images. And you might be able to pipe that result to potrace. – fmw42 Oct 21 '19 at 17:13
  • You can change the sequence `negate-dilate-negate` to `erode`. So your command becomes `magick oddish.bmp -colorspace gray -morphology erode disk bmp:- | potrace ...` – Mark Setchell Oct 22 '19 at 12:55

0 Answers0