# How to reduce size of the stl file generated through python script?

**URL:** <https://discourse.slicer.org/t/how-to-reduce-size-of-the-stl-file-generated-through-python-script/6414>\
**Category:** Development\
**Created:** [April 5, 2019, 9:58pm UTC](https://discourse.slicer.org/t/how-to-reduce-size-of-the-stl-file-generated-through-python-script/6414 "2019-04-05T21:58:23Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 9, 2019, 4:23am UTC](https://discourse.slicer.org/t/how-to-reduce-size-of-the-stl-file-generated-through-python-script/6414/3 "2019-04-09T04:23:55Z")

</div>

@techrama Would you like to tell us what the code snippet above is supposed to do?

@Siddharth_Sharma You can decrease size & quality of the generated mesh by adding this line before `CreateClosedSurfaceRepresentation` method call:

```
segmentationNode.GetSegmentation().SetConversionParameter("Decimation factor", "0.9") 

```

The parameter value is between 0.0-1.0 and it specifies the fraction points that you would like to remove from the mesh.

---

_[View the full topic](https://discourse.slicer.org/t/how-to-reduce-size-of-the-stl-file-generated-through-python-script/6414)._
