CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   How to export Paraview images that fit Latex requirements (https://www.cfd-online.com/Forums/main/229777-how-export-paraview-images-fit-latex-requirements.html)

mazhar16823 August 24, 2020 07:27

How to export Paraview images that fit Latex requirements
 
Hi,


I am exporting the images from the Paraview to Latex but it seems that images are large in size when pasted in Latex Window. I looked for the options to reduce the screen size in Paraview but couldn't find it. Any suggestions please?

bluebase August 28, 2020 06:00

Quote:

Originally Posted by mazhar16823 (Post 781186)
I am exporting the images from the Paraview to Latex but it seems that images are large in size when pasted in Latex Window. I looked for the options to reduce the screen size in Paraview but couldn't find it. Any suggestions please?

Not exactly sure what you mean with "Paraview to Latex" and "Latex Window".
I'll assume that you exported some image format, such as png, and jpeg, and inserted into a latex WYSIWYG editor.

If the exported image size is too large, you could scale down the resolution with third-party software, such as Gimp, ImageMagick, or any other image processor.

Since you are using latex, you can declare your includegraphics with the width option to scale the image to the linewidth (or any other document spec). Such as:
Code:

\includegraphics[width=\linewidth]{figure.png}
Is there a reason why you have not considered this before?

mazhar16823 September 3, 2020 07:50

Quote:

Originally Posted by bluebase (Post 781528)
Not exactly sure what you mean with "Paraview to Latex" and "Latex Window".
I'll assume that you exported some image format, such as png, and jpeg, and inserted into a latex WYSIWYG editor.

If the exported image size is too large, you could scale down the resolution with third-party software, such as Gimp, ImageMagick, or any other image processor.

Since you are using latex, you can declare your includegraphics with the width option to scale the image to the linewidth (or any other document spec). Such as:
Code:

\includegraphics[width=\linewidth]{figure.png}
Is there a reason why you have not considered this before?


Thanks. I didn't use the script that you suggested because I was using "scale=0.X" while adding the figure. Sometimes I need to put two or even four pictures side by side so this scale helps but on the other hand, pixels are compromised.

schnafkid December 5, 2020 10:02

I think there are way better options to include PV-Data in TeX-files. I mean, you could just export sceenshots, but you could as well use word do make your document in this case. I'm trying right now to find a quick way to do this without screenshots, hence using "Save Data".



Does anyone have experience to do that? I would like to see the legend in the latex-documents font, and also to be able choose the colors myself in latex.

bluebase December 6, 2020 16:47

Instead of screenshots, export the scene. That way some overlayed elements can be exported vectorized. Though, lacking advanced experience with paraview, i dont know whether there is a way to completely export a scene vectorized---I doubt it.
The gl2ps library used to export scenes to eps, pdf, and svg practically can export strings to tex files. There are also some locations in the source, which do register that interface to paraview. I haven't investigated any further where the interface is calling these functions...


A doable workaround is to save a scene as svg, and then use inkscape to further convert it export to pdf/... + latex. That way, you could at least have the legend in the font of your document.


Letting latex actually recreate a picture with your own colors is likely out of scope of any document creators (including word). Maybe there is some fancy ways with tikz, metapost, or another specialized extension ...


Going further offtopic, i remember to read something about embedding 3d models into pdfs is possible---to get an interactive document; have look here. But that requires some javascript magic which is likely not very portable.

schnafkid December 7, 2020 04:15

Thanks for the quick reply!

Im just a windows user, hence no experience messing with any source code… Only using Paraview's GUI. Also, my document does not have to be perfect, I just hoped that there was a way to achieve this in a reasonable time.

I found a way to import Paraview-visuals into latex docs using \usepackage{epstopdf}. That way you can import any *.eps-file you generated in Paraview (File>Export Scene>*.eps) via \includegraphics{*.eps}. Of course that is also possible with regular screenshots, but I think you can get vectorized visuals out out of there. I just couldn't figure out how by now, will repost when I have.

The "fancy way" would be to eport the data as *.csv (table) and then set up the field(s) with \usepackage{pgfplots} which is way to time consuming in my case. Interactive would be next level difficult and in most of the time not even a quality improvement, but maybe someone sometime will do that.

qutadah.r March 24, 2022 17:16

you could also use the option "lock view size custom" from Tools menu in ParaView and screenshot size will be adjusted accordingly.


All times are GMT -4. The time now is 04:30.