CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

How to export Paraview images that fit Latex requirements

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 24, 2020, 07:27
Default How to export Paraview images that fit Latex requirements
  #1
Senior Member
 
MA
Join Date: Mar 2020
Posts: 163
Rep Power: 6
mazhar16823 is on a distinguished road
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?
mazhar16823 is offline   Reply With Quote

Old   August 28, 2020, 06:00
Default
  #2
Senior Member
 
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 566
Rep Power: 20
bluebase will become famous soon enough
Quote:
Originally Posted by mazhar16823 View Post
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?
bluebase is offline   Reply With Quote

Old   September 3, 2020, 07:50
Default
  #3
Senior Member
 
MA
Join Date: Mar 2020
Posts: 163
Rep Power: 6
mazhar16823 is on a distinguished road
Quote:
Originally Posted by bluebase View Post
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.
mazhar16823 is offline   Reply With Quote

Old   December 5, 2020, 10:02
Default
  #4
New Member
 
David Dudli
Join Date: Oct 2020
Location: Switzerland
Posts: 8
Rep Power: 5
schnafkid is on a distinguished road
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.
schnafkid is offline   Reply With Quote

Old   December 6, 2020, 16:47
Default
  #5
Senior Member
 
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 566
Rep Power: 20
bluebase will become famous soon enough
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.
bluebase is offline   Reply With Quote

Old   December 7, 2020, 04:15
Thumbs up
  #6
New Member
 
David Dudli
Join Date: Oct 2020
Location: Switzerland
Posts: 8
Rep Power: 5
schnafkid is on a distinguished road
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.
schnafkid is offline   Reply With Quote

Old   March 24, 2022, 17:16
Default
  #7
Senior Member
 
qutadah
Join Date: Jun 2021
Location: USA
Posts: 101
Rep Power: 4
qutadah.r is on a distinguished road
you could also use the option "lock view size custom" from Tools menu in ParaView and screenshot size will be adjusted accordingly.
qutadah.r is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Guide: Writing Equations in LaTeX on the CFD Online Forums pete Site Help, Feedback & Discussions 27 May 19, 2022 03:19
[OpenFOAM.org] Compilation Error with OpenFOAM-5.x using Intel Compilers aow OpenFOAM Installation 4 April 25, 2019 16:17
[General] A "clean" solution to export binary ensight gold format from Fortran to Paraview? flotus1 ParaView 1 June 23, 2015 11:59
[General] Can ParaView Zoom to fit? noah_r ParaView 0 June 20, 2014 16:33
Paraview does not show any images Thriceguy OpenFOAM 3 April 17, 2011 20:20


All times are GMT -4. The time now is 19:51.