Is it possible with imagemagick (ie. the convert command line tool) to center an image of an svg inside its bounding box? or crop the image to the bounding box somehow? if not then is there ANY tool out there (command line im looking for only) that can do this? ie. ghostscript, inkscape, etc.
here is an example of my problem(s): svg viewed in adobe illustrator
btw i also have the original eps of the file which i converted using ghostscript to svg but the eps is ALSO outside the bounding box...
Center image of SVG or EPS inside its bounding box?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Center image of SVG or EPS inside its bounding box?
Please provide your source file and your IM version and platform. Please read viewtopic.php?f=1&t=9620
Re: Center image of SVG or EPS inside its bounding box?
ImageMagick 6.7.2-7 2015-07-29 Q16
CentOS 6.7 x64
https://www.dropbox.com/s/x9r1lz68tv7faza/J.svg?dl=0
https://www.dropbox.com/s/k4rd6tm9rc6yccm/J.eps?dl=0
CentOS 6.7 x64
https://www.dropbox.com/s/x9r1lz68tv7faza/J.svg?dl=0
https://www.dropbox.com/s/k4rd6tm9rc6yccm/J.eps?dl=0
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Center image of SVG or EPS inside its bounding box?
These work for me on IM 6.9.2.9 Q16 Mac OSX.
Code: Select all
convert J.eps -trim +repage J2.eps
convert J.eps -trim +repage J2.svg
Re: Center image of SVG or EPS inside its bounding box?
Ok thx I'll try this out and report back, sorry for late reply busy with so many things (holiday season
Re: Center image of SVG or EPS inside its bounding box?
neither worked for me, got awful results. and converting eps to svg created a 60MB svg file wtf lol?\
the first command created ugly jagged edges like it was rasterized.
plus it didnt do wut i asked for. the bounding box remained the same size (really small).
id like to see ur results, i dont know how it could possibly work for u those commands...
found this btw but havent tried it yet:
http://superuser.com/questions/198460/c ... svg-format
states:
Uniconverter is currently the most convenient option.
It's a command-line tool that shares code with the sK1 Project. You won't have to bother cropping the image in sK1 if you use uniconverter, so it's more automated.
Run it like this:
uniconverter before.eps after.svg
And that's it. I tried it on one EPS, but the SVG was offset improperly, but it may work for you.
Here's a list of alternatives and reasons why they suck:
The sK1 Project
It has the sense of a "page" that you put your drawing on, so after you import an EPS, you have to move it around and manually crop the page.
ImageMagick
For EPS to SVG conversion, ImageMagick does some really stupid bitmap conversion and will render SVG files that are 50mb, when they should be a few kb. It doesn't actually have a real vector conversion algorithm for these formats.
InkScape
Every time I've converted an EPS with InkScape, it's messed up the colours. This is due to an Inkscape bug with importing EPS files. (Update: Fix Released for this bug on February 2015)
Gimp
Gimp just does the same stupid bitmap conversion that ImageMagick does.
Scribus
It gets the colours of my EPS file even more wrong than Inkscape, while Preview for Mac can read it just fine.
the first command created ugly jagged edges like it was rasterized.
plus it didnt do wut i asked for. the bounding box remained the same size (really small).
id like to see ur results, i dont know how it could possibly work for u those commands...
found this btw but havent tried it yet:
http://superuser.com/questions/198460/c ... svg-format
states:
Uniconverter is currently the most convenient option.
It's a command-line tool that shares code with the sK1 Project. You won't have to bother cropping the image in sK1 if you use uniconverter, so it's more automated.
Run it like this:
uniconverter before.eps after.svg
And that's it. I tried it on one EPS, but the SVG was offset improperly, but it may work for you.
Here's a list of alternatives and reasons why they suck:
The sK1 Project
It has the sense of a "page" that you put your drawing on, so after you import an EPS, you have to move it around and manually crop the page.
ImageMagick
For EPS to SVG conversion, ImageMagick does some really stupid bitmap conversion and will render SVG files that are 50mb, when they should be a few kb. It doesn't actually have a real vector conversion algorithm for these formats.
InkScape
Every time I've converted an EPS with InkScape, it's messed up the colours. This is due to an Inkscape bug with importing EPS files. (Update: Fix Released for this bug on February 2015)
Gimp
Gimp just does the same stupid bitmap conversion that ImageMagick does.
Scribus
It gets the colours of my EPS file even more wrong than Inkscape, while Preview for Mac can read it just fine.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Center image of SVG or EPS inside its bounding box?
ImageMagick is a raster image processor, not a vector image processor. If you want to process a vector image and keep it as a vector, IM is not the correct tool.
snibgo's IM pages: im.snibgo.com
Re: Center image of SVG or EPS inside its bounding box?
Ok thx I didn't know thatsnibgo wrote:ImageMagick is a raster image processor, not a vector image processor. If you want to process a vector image and keep it as a vector, IM is not the correct tool.
Re: Center image of SVG or EPS inside its bounding box?
I think, Illustrator or Corel will help you to solve this case.
ImageMagick user. Design like Culina aus Polen