# Convert VTK ASCII to Binary to save space

**URL:** https://discourse.paraview.org/t/convert-vtk-ascii-to-binary-to-save-space/2660
**Category:** ParaView Support
**Tags:** vtk
**Created:** [September 30, 2019, 7:48pm UTC](https://discourse.paraview.org/t/convert-vtk-ascii-to-binary-to-save-space/2660 "2019-09-30T19:48:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Raj2019](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@Raj2019](https://discourse.paraview.org/u/Raj2019)
#### Post date: [September 30, 2019, 7:48pm UTC](https://discourse.paraview.org/t/convert-vtk-ascii-to-binary-to-save-space/2660/1 "2019-09-30T19:48:50Z")

</div>

I have a .vtk file (0.25 TB) n ASCII format which I visualize in ParaView. I like to transfer the data to my collaborators for which I would like to convert it into a binary format.

I tried to search through the internet and was unsuccessful in obtaining a solution.

Can anyone help me with this ?

Thanks.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [September 30, 2019, 8:08pm UTC](https://discourse.paraview.org/t/convert-vtk-ascii-to-binary-to-save-space/2660/2 "2019-09-30T20:08:11Z")

</div>

If you are able to load it into ParaView, then you can easily save the data to a binary format through the _File_ -\> _Save Data…_ menu item, then choose the VTK Legacy writer. Once you set the file name and click OK, an options dialog for the writer appears.

![image](https://discourse.paraview.org/uploads/default/original/2X/b/b507fa9b4867bbbad771135a810ac831b6246d61.png)

By default, the output will be binary, so you can click OK and you have now saved out a binary .vtk file.

You may also be interested in saving to the XML output file type that also supports binary encoding and compression with various compression algorithms. Those options are presented in the same dialog as above when you save to an XML format.

---

<div class="post-metadata">

### Author: ![Raj2019](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@Raj2019](https://discourse.paraview.org/u/Raj2019)
#### Post date: [September 30, 2019, 8:26pm UTC](https://discourse.paraview.org/t/convert-vtk-ascii-to-binary-to-save-space/2660/3 "2019-09-30T20:26:21Z")

</div>

Thanks Cory.

The file is too large (0.25 TB) to be loaded into ParaView for visualization. Is there a way to do it using Python script ?

---

<div class="post-metadata">

### Author: ![vrkssai](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/v/e19b73/32.png) [@vrkssai](https://discourse.paraview.org/u/vrkssai)
#### Post date: [February 21, 2020, 5:41pm UTC](https://discourse.paraview.org/t/convert-vtk-ascii-to-binary-to-save-space/2660/4 "2020-02-21T17:41:12Z")

</div>

```auto
from paraview.simple import *
r = LegacyVTKReader( FileNames=['Yourfilename.vtk'] )
SaveData('Yourfilename_binary.vtk', proxy=r)

```

Should save as binary by default.

used from: [https://stackoverflow.com/a/58209834](https://stackoverflow.com/a/58209834)

---

<div class="post-metadata">

### Author: ![acmresende](https://discourse.paraview.org/user_avatar/discourse.paraview.org/acmresende/32/4862_2.png) [@acmresende](https://discourse.paraview.org/u/acmresende)
#### Post date: [September 8, 2020, 6:59pm UTC](https://discourse.paraview.org/t/convert-vtk-ascii-to-binary-to-save-space/2660/6 "2020-09-08T18:59:43Z")

</div>

The function `SaveData()` is not working with Paraview’s older versions (like 3.98.1). I found its implementation [here](https://kitware.github.io/paraview-docs/latest/python/_modules/paraview/simple.html) and moved it to my code. How can I save my file as ASCII? Calling it like `SaveData(filename, proxy=px, FileType='Ascii')` is not working (it saves my files as binaries).
