3

I've got a collection of SVG's that were generated by taking a corresponding collection of PNG's, live-tracing them all in Adobe Bridge, saving them as AI, and converting those AI files to SVG's using Adobe's builtin scripts.

The shapes in the SVG's turned out fine -- however, somewhere in the process a bunch of extra padding was added to the sides of the images. To be more precise, the height and width properties of the itself as well as the dimensions of the viewBox are much larger than the shapes they contain.

Are there any solutions (ranging from string substitution in the .svg's to fancy Adobe scripts) to automatically set the dimensions of the viewBox fit only the shapes, or otherwise crop the SVG to achieve the same effect?

I'm new to SVG, so let me know if there's additional information that could be helpful.

Thanks

j0k
  • 22,600
  • 28
  • 79
  • 90
follyroof
  • 3,430
  • 2
  • 28
  • 26
  • 3
    getBBox can get the bounding box of a shape. Call on the contents and then set the viewBox accordingly. – Robert Longson Apr 10 '13 at 21:35
  • 1
    @RobertLongson: it sounds like this is definitely the way to go. would you mind elaborating a bit on the code itself and showing me where to call getBBox() and how to set the viewBox accordingly? i'm not having much luck with finding any good code examples of what i'm looking to do. presumably there's a – follyroof Apr 10 '13 at 22:08

0 Answers0