Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server-side conversion of raster images to vector images

I would like to convert images that have been uploaded by the user (in various formats and conditions) to a vector image format such as .eps. I'm primarily working in PHP.

What options exist?

like image 535
Jon Kirkman Avatar asked Jul 07 '10 03:07

Jon Kirkman


People also ask

Can a raster image be converted to a vector image?

Converting a raster image into a vector format is a vital step early on in the design process that all designers will need to master. Using tools like CorelDRAW's PowerTRACE, vectorization of images is made simple for seamless integration of bitmap assets into your designs.

Can raster data be converted to vector?

There are tools available to facilitate conversion between raster and vector data types. The procedure outlined in this guide describes the steps used to convert a digital elevation model (DEM) raster to vector format so that the result may be overlaid with a vector polygon layer for further analysis.


2 Answers

There are a small number of autotracing software projects released under GPU (for example, POTRACE that you could run via system commands. I can't attest to their quality. Tracing almost always requires some element of human supervision to avoid things looking like a mess of broken pottery, but you won't know until you try. Rather than triggering the tracer via PHP, I would use PHP simply to save incoming images to a temporary folder and then, through cronjob (one- or two-per-minute), crank through the holding folder in batches (you could pace it that way and avoid it being used as a way to DoS your site).

I'm thinking of doing something slightly similar (though not graphic related) for an upcoming project, and I'm considering doing all my heavy lifting on a desktop machine, which would fetch all incoming files and process them before FTPing them back to the server. I'm somewhat nervous about having any complex resource-intensive script like this running on a web server.

like image 77
Andrew Avatar answered Nov 06 '22 15:11

Andrew


Definitelly you can do this with the Inkscape

here is the list of formats it supports What formats can Inkscape import/export?

and it can be of course used with the command line or exec() command Can Inkscape be used from the command line?

like image 26
Vladimir Avatar answered Nov 06 '22 16:11

Vladimir