Skip to content
المشاريع

حول

bitmap to vector graphics converter

التصميم والوسائط

كيف تُقاس هذه الأرقام

ما يمكنك فعله

  • Outline and centerline tracing - trace the edges or centerlines of shapes
  • Color reduction - reduce colors for cleaner output
  • Despeckling - remove noise from images
  • Multiple formats - supports numerous input formats (PNG, BMP, PNM, TGA, etc.) and output formats (SVG, EPS, PDF, DXF, etc.)

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
+٢
خلال 15 يومًا
+٣
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

AutoTrace

REUSE status Coverity passed OpenSSF Best Practices Build status on Linux Build status on macOS Build status on FreeBSD Build status on Windows

AutoTrace is a program for converting bitmap images to vector graphics.

Features

  • Outline and centerline tracing - trace the edges or centerlines of shapes
  • Color reduction - reduce colors for cleaner output
  • Despeckling - remove noise from images
  • Multiple formats - supports numerous input formats (PNG, BMP, PNM, TGA, etc.) and output formats (SVG, EPS, PDF, DXF, etc.)

Installation

Package Managers

macOS:

brew install autotrace
# or
port install autotrace

Linux:

# Fedora/RHEL
sudo dnf install autotrace

# Arch Linux
sudo pacman -S autotrace

# Debian/Ubuntu - build from source (see below)

FreeBSD:

pkg install autotrace

Windows

Download the installer from the Releases page.

Available installers:

  • autotrace-VERSION-win32-setup.exe (32-bit)
  • autotrace-VERSION-win64-setup.exe (64-bit)

Building from Source

See INSTALL for detailed instructions.

Requirements:

  • C compiler (GCC, Clang, MSVC)
  • libpng (optional, for PNG support)
  • ImageMagick or GraphicsMagick (optional, for additional formats)
  • GLib 2.58 or newer

Quick start:

# System-wide installation (requires root)
./autogen.sh
./configure
make
sudo make install

# User-local installation (no root needed)
./autogen.sh
./configure --prefix=$HOME/.local
make
make install

Usage

Command Line

Convert a bitmap to SVG:

autotrace input.png -output-file output.svg

Trace centerlines:

autotrace input.png -centerline -output-file output.svg

Reduce colors before tracing:

autotrace input.png -color-count 4 -output-file output.svg

For complete options, see autotrace --help or man autotrace.

Library

AutoTrace can be used as a library (libautotrace). Here's a minimal example that traces image.png and writes SVG to standard output:

#include <stdio.h>
#include <autotrace/autotrace.h>

/* Errors and warnings come through this callback.  An error, such as a
   file that can't be read, is AT_MSG_FATAL.  */
static void report(const gchar *msg, at_msg_type type, gpointer data)
{
  (void)data; /* the client data given with the callback: unused here */
  fprintf(stderr, "autotrace: %s%s\n", type == AT_MSG_FATAL ? "error: " : "", msg);
}

int main(void)
{
  at_bitmap_reader *reader;
  at_bitmap *bitmap;
  at_fitting_opts_type *opts;
  at_splines_type *splines;
  at_spline_writer *writer;

  /* Registers the input and output formats: call it first. */
  autotrace_init();
  /* Don't generate the debugging messages tracing writes for nearly every
     point: formatting them takes most of the running time.  */
  at_set_log_level(G_LOG_LEVEL_WARNING);

  reader = at_input_get_handler("image.png");
  if (reader == NULL)
    return 1;
  /* Both return NULL after an error, which report() has printed.  */
  bitmap = at_bitmap_read(reader, "image.png", NULL, report, NULL);
  if (bitmap == NULL)
    return 1;

  opts = at_fitting_opts_new();
  splines = at_splines_new(bitmap, opts, report, NULL);
  if (splines == NULL) {
    at_fitting_opts_free(opts);
    at_bitmap_free(bitmap);
    return 1;
  }

  writer = at_output_get_handler_by_suffix("svg");
  at_splines_write(writer, stdout, "", NULL, splines, NULL, NULL);

  at_splines_free(splines);
  at_fitting_opts_free(opts);
  at_bitmap_free(bitmap);
  return 0;
}

Compile with:

gcc sample.c $(pkg-config --cflags --libs autotrace)

See autotrace.h for full API documentation.

Supported Formats

Input formats: PNG, BMP, TGA, PNM (PBM/PGM/PPM), GF

  • With ImageMagick/GraphicsMagick: JPEG, TIFF, GIF, and many more

Output formats: SVG, EPS, PDF, AI, DXF, CGM, EMF, MIF, ER, Fig, and many others

List all formats: autotrace --list-input-formats or autotrace --list-output-formats

Translation

AutoTrace uses GNU gettext for internationalization. Help translate AutoTrace into your language!

Translation status

For translators: Visit our Weblate project to start translating. See TRANSLATING.md for detailed guidelines.

For developers: When adding translatable strings, wrap them with _() and run ./po/update-pot.sh to update the translation template. See TRANSLATING.md for details.

Contributing

Contributions welcome! See our issue tracker and TODO file.

Areas where help is needed:

  • Bug fixes and improvements
  • Documentation
  • Additional format support
  • Plugin development for image editors
  • Your ideas and suggestions!

Making a release

Only the maintainer tags and publishes releases. A release starts as a pull request with a single commit. That commit bumps the version and the libtool version-info in configure.ac, adds a NEWS entry, regenerates po/autotrace.pot and the EMF and CGM golden files. Before the pull request is opened, make distcheck must pass locally. Pushing the tag then builds the Windows installers and uploads them to the GitHub release. The source release is GitHub's automatic archive of the tag.

The full checklist is in AGENTS.md, "Versioning and releases". That section also covers how to choose the version number and how to check API/ABI compatibility against the previous release.

License

  • Program: GPL v2 or later
  • Library (libautotrace): LGPL v2.1 or later
  • Input/output modules can be used under either license

History

AutoTrace was originally developed by Martin Weber. Some code was derived from the limn program in GNU fontutils, though most has been completely rewritten.

Links

Author

Martin Weber ([email protected])

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…