Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to export a simple cuboid into .SVG format. In the output file, the cuboid is finely meshed, which increases the file size. How to remove this detailed mesh?

 Export[FileNameJoin[{NotebookDirectory[], "trial.svg"}], Graphics3D[Cuboid[]]]

enter image description here

share|improve this question
6  
If you want the svg file size reduced, I found this reduces it from 48k to 15k on windows 7, using V 9.01 Export["trial.svg", Graphics3D[{FaceForm[], Cuboid[]}]] This removes all face information. –  Nasser Dec 3 '13 at 3:06
    
@Nasser, your answer is already good enough for me, thanks! –  saturasl Dec 3 '13 at 19:23
add comment

1 Answer

up vote 7 down vote accepted

This mesh depends on the whole size of the Graphics3D:

Export["trial.svg", Graphics3D[Cuboid[], PlotRange -> 5, Boxed -> False], 
   Background -> None]

It produces 2.8 KB file (15x reduction) on Linux without the detailed mesh

enter image description here

For further size reduction you can use compressed SVGz format

Export["trial.svgz", ...]

It produces 666 B file. This ability seems to be undocumented.

share|improve this answer
    
Nice! I wonder why ... –  belisarius Dec 3 '13 at 15:18
    
@ybeltukov, Your answer shows another example of undocumented attribute... Because in the documentation of SVG format there is no information about the Background. But I understand that the bounding box can itself takes some amount of file storage, so turning it off reduce file size. Thanks! –  saturasl Dec 3 '13 at 19:39
1  
@saturasl The Background option is hidden in Details section in the documentation of Export. See also my update about svgz format. A lot of applications can use it. It can be useful for you. –  ybeltukov Dec 3 '13 at 21:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.