How To Enable Autotrace? -- Installed IM with OSX MacPorts

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
wobsie

How To Enable Autotrace? -- Installed IM with OSX MacPorts

Post by wobsie »

I have ImageMagick 6.5.1-0 installed on OS X using MacPorts. Autotrace 0.31.1 has also been installed using MacPorts. Both work fine independently, and I can invoke autotrace from IM using the delegate command:

Code: Select all

convert autotrace:A.gif  A_traced.png
But I'd like to be able to invoke autotrace w/o the delegated command, like this:

Code: Select all

convert A.gif  A_traced.svg
Is there a way to do this w/o having to download IM 6.5.1 source code and recompiling? Do I really have to download the source and recompile using --with-autotrace?

Thx.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How To Enable Autotrace? -- Installed IM with OSX MacPorts

Post by magick »

The autotrace library and header files must be installed when ImageMagick is built and the --with-autotrace configure script command line option must be included when configuring ImageMagick. Check the output of the configure script to verify autotrace was validated. Next build and install ImageMagick.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How To Enable Autotrace? -- Installed IM with OSX MacPorts

Post by anthony »

this is also mentioned in IM Examples where using autotrace is looked at.

IM Examples, Drawing, SVG Output Handling
http://www.imagemagick.org/Usage/draw/#svg_output

NOTE using the autotrace command itself is usedful as you can extract the 'SVG draw path' it generates, allowing you to modify it to produce very different images (smoothed and outline) from the original bitmap shape.

See IM Examples, Transforms, Edging using a Raster to Vector Converter
http://www.imagemagick.org/Usage/transform/#edge_vector


Note I did have a problem with the pre-built autotrace library for Fedora as it has a reversed dependency on an older version of IM. I had to build a new set of RPM packages without that dependency. this is probably not a problem with Ubuntu Linux or MacOSX
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
augr
Posts: 7
Joined: 2011-05-22T22:48:27-07:00
Authentication code: 8675308

Re: How To Enable Autotrace? -- Installed IM with OSX MacPor

Post by augr »

magick wrote:The autotrace library and header files must be installed when ImageMagick is built and the --with-autotrace configure script command line option must be included when configuring ImageMagick. Check the output of the configure script to verify autotrace was validated. Next build and install ImageMagick.
It look like the make file already specifies the rsvg. Are you suggesting to add --with-autotrace in the current rsvg config_args or create a new one or maybe even replace the existing reference?

Here's what the current make file specifies (freeBSD port):

Code: Select all

# SVG (Scalable Vector Graphics) requires both libxml2 and X11
.if defined(WITH_IMAGEMAGICK_SVG) && !defined(WITHOUT_X11)
USE_GNOME+=		libxml2
LIB_DEPENDS+=		rsvg-2:${PORTSDIR}/graphics/librsvg2
CONFIGURE_ARGS+=	--with-rsvg --with-xml
CONFIGURE_ENV+=		RSVG_CFLAGS="-I${LOCALBASE}/include/librsvg-2" \
			RSVG_LIBS="-L${LOCALBASE}/lib"
.else
CONFIGURE_ARGS+=	--without-rsvg --without-xml
.endif
Maybe just add something like this or replace the existing rsvg will work?:

Code: Select all

# SVG (Scalable Vector Graphics)
.if defined(WITH_IMAGEMAGICK_SVG)
LIB_DEPENDS+=		svg:${PORTSDIR}/graphics/autotrace
CONFIGURE_ARGS+=	--with-autotrace

.else
CONFIGURE_ARGS+=	--without-autotrace
.endif
Thanks!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How To Enable Autotrace? -- Installed IM with OSX MacPor

Post by anthony »

It seems to be automatic build now, if the autotrace library is present.

However as I said the fedora version of the library has this bad dependancy back to an older version of IM. Purely for image conversion!

This is my notes on building a autotrace RPM without that dependant.

Code: Select all

Download source RPM
  URL=ftp://mirror.aarnet.edu.au/pub/fedora/linux/releases/14/Everything
      wget $URL/source/SRPMS/autotrace-*.src.rpm
Unpack, re-configure, build
      package=autotrace
      rpm -hiv $package-*.src.rpm
      rm $package-*.src.rpm
      cd ~/rpmbuild
      vi SPECS/$package.spec
        :/^Release:/s/%{dist}/at&/
        :g/Requires.*ImageMagick-devel/ s/^/#/
        :g/Requires.*libexif-devel/ s/^/#/
        :g/Requires.*%{name}/ s/^/#/
        :/^%configure$/s//& --without-magick --without-pstoedit/
        :wq
      rpmbuild -bs SPECS/$package.spec
      rpmbuild -bb SPECS/$package.spec
      find . -name \*.rpm \! -name \*debug\*
Save built package (where ever you like!)
      rm ~/autotrace-*.rpm
      find . -name \*.rpm \! -name \*debug\* -exec mv {} ~ \;
      cd
Install new version (requires root)
      sudo rpm -e --nodeps autotrace
      sudo rpm -e --nodeps autotrace-devel
      sudo rpm -hiv ~/autotrace-0*.at.*.i[36]86.rpm
Exclude Autotrace from yum updates
      echo "exclude=autotrace*" >> /etc/yum.conf
Cleanup
      rm -rf ~/rpmbuild
Basically it grabs a copy of the source RPM, comments out the dependancies and adjusts the autotrace configuration line, as well as modifies the package version (to differentiate it) then repacks and builds the RPMs. No more dependancy on the old version of IM.

Once you have the new RPM installed then the IM should pickup the library and use it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
augr
Posts: 7
Joined: 2011-05-22T22:48:27-07:00
Authentication code: 8675308

Re: How To Enable Autotrace? -- Installed IM with OSX MacPor

Post by augr »

Thanks Anthony I'll give it a try by installing autotrace first then IM as opposed to the other way around which is what I did initially, and see if it works. The ports tree on freeBSD is nicely up to date :D

Cheers!
augr
Posts: 7
Joined: 2011-05-22T22:48:27-07:00
Authentication code: 8675308

Re: How To Enable Autotrace? -- Installed IM with OSX MacPor

Post by augr »

Looks like I also suffered the effects of an old version referenced for pecl-imagick. My IM and AT were installed fine but pecl wasn't. Everything seems to be ok now.

Do you happen to know where I can find some sample php for a simple png to svg conversion script? I'm not worried about resulting image for now, just the conversion using php.

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

Re: How To Enable Autotrace? -- Installed IM with OSX MacPor

Post by anthony »

Sorry. If it was me I would probably make command calls from the PHP to do the task. Seems to get less problems.
http://www.imagemagick.org/Usage/api/#php

For example see the 'passthru' script. It outputs a JPG, but it could also output SVG instead.

I would also suggest you ask your new question as a new topic!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
VanGog
Posts: 308
Joined: 2012-02-05T02:46:58-07:00
Authentication code: 8675308

Re: How To Enable Autotrace? -- Installed IM with OSX MacPor

Post by VanGog »

I try to run autotrace independently, but is it possible to specify location for cache drive? Or I must move the program on drive where is enough space?

It looks I cannot use autotrace because it writes data to system disk, and no space left.
augr
Posts: 7
Joined: 2011-05-22T22:48:27-07:00
Authentication code: 8675308

Re: How To Enable Autotrace? -- Installed IM with OSX MacPorts

Post by augr »

Sorry to wake up an old thread but I'm back at installing autotrace with the latest version of ImageMagick.

I can't for the life of me remember how I managed to make it all work.

Also, I am now installing in an Amazon Linux instance.

So my problem is getting IM and AT installed and playing together. Any ideas?

Seems ya'll have it working on your systems: http://www.imagemagick.org/script/advan ... lation.php (autotrace value =yes)

I tried installing autotrace --without-magick as well but no luck.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How To Enable Autotrace? -- Installed IM with OSX MacPorts

Post by anthony »

IM may need to be rebuilt with configuration option --with-autotrace
For example

Code: Select all

convert -list Configure | grep trace
shows me my current version (a software package) has --with-autotrace=no
So it was not built with autotrace

While my IMv7 version (self compiled)

Code: Select all

magick -list Configure | grep trace
has CONFIGURE ... --with-autotrace
and DELEGATES ... autotrace
so it was built with autotrace (it was installed and the IM build found it on my system)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply