Would you like to try to give this a go? Regards,
Edward On 13 June 2013 16:35, Troels Emtekær Linnet <tlin...@gmail.com> wrote: > I am happy that you think it is great. :-) > > As soon there is a file type, which can fast be opened by a image viewer, I > am happy. > > It works for PNG here, and it is very probably a compilation issue. > I have PNG as a possibility to print in my xmgrace menu. > > I found the commands here: > http://ringo.ams.sunysb.edu/index.php/Xmgrace > > This is for EPS and PNG, but I havent found options for JPEG yet. > > I would say the "more the merrier". > It take's time to create scripts, but no time to delete. > > Best > Troels > > > > > Troels Emtekær Linnet > > > 2013/6/13 Edward d'Auvergne <edw...@nmr-relax.com> >> >> That's a great trick! My knowledge of Grace is not that extensive. >> You know what would be even better - if the >> relax_disp.plot_disp_curves user function created this script and >> dropped it into the directory with the Grace files! I've now shifted >> the code into the >> specific_analyses.relax_disp.disp_data.plot_disp_curves() function. >> Such a script could easily be created at the end of this function - >> best by calling a special function in lib.software.grace. >> >> What would be good would be to generate one script for the PNG files, >> maybe called 'grace_to_png.sh' just to be more informative to the user >> that this is for conversion and that it is a shell script, one for EPS >> files called possibly 'grace_to_eps.sh', and a third called >> 'eps_to_pdf.sh'. The plot_disp_curves() function can even make them >> executable for the user. I suggest that the *.tmp files be removed by >> the script at the end. >> >> The only problem is that I tried this and received error messages and >> broken files: >> >> Unknown device: DEVICE "PNG" FONT ANTIALIASING ON >> Unknown device: DEVICE "PNG" OP "compression:9" >> File modifications are disabled in safe mode: PRINT >> File modifications are disabled in safe mode: PRINT >> disp_:70@N agr >> >> The EPS files are created successfully. I'm not sure why the PNGs >> failed, maybe it's not compiled in. JPEG and SVG are present in the >> print options through the GUI though, so maybe scripts for these >> formats can be very easily created as well. A simple loop over 'PNG', >> 'EPS', 'SVG', and 'JPEG' could create separate scripts for each format >> and make them executable, and then at the end the 'eps_to_pdf.sh' can >> be created. The script generation could be documented in the user >> function docstring. What do you think? >> >> Cheers, >> >> Edward >> >> >> On 13 June 2013 14:31, Troels Emtekær Linnet <tlin...@gmail.com> wrote: >> > Hi. >> > >> > I got tired of opening each xmgrace file to see the plot. >> > I found that to export to png, you need to: >> > >> > Add this to the end of the xmgrace file >> > >> > #Print out to >> > @PRINT TO "/home/you/output.png" >> > @HARDCOPY DEVICE "PNG" >> > @DEVICE "PNG" FONT ANTIALIASING on >> > # Make white background transparent >> > #@DEVICE "PNG" OP "transparent:on" >> > @DEVICE "PNG" OP "compression:9" >> > @PRINT >> > >> > Then issue an "HARDCOPY" with xmgrace >> >> xmgrace -hardcopy xmgracefile.agr >> > >> > >> > Script to make both png and eps for a folder with xmgrace files >> > >> > Write in: xmgrace_png >> > and put in your bin folder >> > >> > #!/bin/bash >> > >> > for gracefile in *.agr; do >> > filename=$(basename "$gracefile") >> > extension="${filename##*.}" >> > filename="${filename%.*}" >> > >> > TMPPNG=${filename}_png.tmp >> > cat $gracefile > $TMPPNG >> > echo "#Print out to" >> $TMPPNG >> > echo '@PRINT TO "'"${PWD}/${filename}.png"'"' >> $TMPPNG >> > echo '@HARDCOPY DEVICE "PNG"' >> $TMPPNG >> > echo '@DEVICE "PNG" FONT ANTIALIASING on' >> $TMPPNG >> > echo '# Make white background transparent' >> $TMPPNG >> > echo '#@DEVICE "PNG" OP "transparent:on"' >> $TMPPNG >> > echo '@DEVICE "PNG" OP "compression:9"' >> $TMPPNG >> > echo '@PRINT' >> $TMPPNG >> > xmgrace -hardcopy $TMPPNG >> > >> > TMPEPS=${filename}_eps.tmp >> > cat $gracefile > $TMPEPS >> > echo "#Print out to" >> $TMPEPS >> > echo '@PRINT TO "'"${PWD}/${filename}.eps"'"' >> $TMPEPS >> > echo '@HARDCOPY DEVICE "EPS"' >> $TMPEPS >> > echo '@DEVICE "EPS" OP "level2"' >> $TMPEPS >> > echo '@PRINT' >> $TMPEPS >> > xmgrace -hardcopy $TMPEPS >> > >> > echo "$filename $extension" >> > #eps2png -resolution 200 $TMPEPS >> > #epstopdf $TMPEPS >> > done >> > >> > Then just make "chmod +x xmgrace_png >> > and in the folder, issue an: >> > >> > xmgrace_png >> > >> > sit back and relax >> > >> > If you want to convert eps to pdf >> > >> > bash ; >> > for epsfile in *.eps; epstopdf $epsfile; echo "Making pdf: $epsfile"; >> > done >> > >> > Troels Emtekær Linnet >> > >> > _______________________________________________ >> > relax (http://www.nmr-relax.com) >> > >> > This is the relax-users mailing list >> > relax-users@gna.org >> > >> > To unsubscribe from this list, get a password >> > reminder, or change your subscription options, >> > visit the list information page at >> > https://mail.gna.org/listinfo/relax-users > > _______________________________________________ relax (http://www.nmr-relax.com) This is the relax-users mailing list relax-users@gna.org To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-users