Get Cairo output stream content when using PyCairo/CairoSharp/Inkscape - cairo

Throughout the Cairo source, there are various statements like:
_cairo_output_stream_printf (ctx->stream, "~> %f %f <~", ix, iy);
Is it possible to get the output stream contents to print to console or a file when using a Cairo wrapper or something that uses Cairo (e.g. PyCairo, CairoSharp, Inkscape). Being able to get this information when using Inkscape from the command line would be particularly wonderful. Having to modify the Inkscape source and build from that would be fine so long as the changes aren't too complex.
Thanks.

Related

export image fails using cmaple.exe but OK using maple.exe

Is there a difference from running the same exact Maple commands to export a plot, when run from GUI interface, using worksheet, vs. from plain text .mpl file using command line Maple?
The following code runs OK from the GUI worksheet, but gives error
Error, invalid FONT specification when run from cmaple.exe.
This is on windows 10.
#file T1.mpl
currentdir("C:/TMP"); #or any other folder of your choice
plotsetup(default); #start from default
#the following commnad below export a plot to a file
plotsetup(ps, plotoutput="t.ps",
plotoptions=`color,noborder,portrait,height=250`);
p0:=DEtools:-DEplot( diff(y(x),x)=x, y(x), x=-2..2, y=-2..2,
'color' = "#00aaff",
'arrows'='medium',
'labels'=["",""],
'thickness'=1
):
#this will send the plot to a file.
print(plots:-display([p0],'view'=[-2..2.4,-2..2.5],
axis=[tickmarks=['color'='red']],
font=["Times",bold,8]
)
);
#ERROR SHOWS HERE
plotsetup(default); #rest back to default
The print command above, does not actually display anything, even on the GUI, since it was redirected to go to a file.
The above code works with no problem in the GUI interface, and the plots is exported OK to t.ps file.
I am trying to run the large Maple code I have from .mpl using command line Maple, hoping it will be faster than in worksheet, but the above problem is making it not possible.
First time trying cmaple.exe
Command I used is
"C:\Program Files\Maple 2018\bin.X86_64_WINDOWS\cmaple.exe" T1.mpl
May be I need an option to add to the command above?
This is using Maple 2018.1
The plot export driver in the Commandline Interface (CLI, aka TTY) does not know about the more modern calling sequences allowed for the various font related plotting options.
In modern Maple the font options can be specified using strings instead of names. That helps users avoid issues with assigning to alternative all-caps name forms, not all of which are protected names.
Unfortunately, it seems as if the CLI plot export driver does not know about the newer string forms. I will submit a bug report.
But you can still use the older, all-caps, name form.
Replace,
font=["Times",bold,8]
by,
font=[TIMES,BOLD,8]
Back when I was quite current with Maple, the answer to this question would have been: the GUI and the TTY version use different plot drivers. And the TTY plot drivers are not as well maintained as the ones for the GUI, and so more recent features do not always work for them.
I am guessing that this is still the case, and that the TTY plot driver doesn't know about fonts.

Is there any way to convert lammp_file.data to Gromacs files (top and gro), if not then to or to CHARMM files (psf and pdb)?

I have a lammps_file.data and I need to convert it to Gromacs files (gro and top) to run my simulations.
Does anyone know how to do this?
Another choice is to convert from lammps to charmm files (psf and pdb). Once I get the charmm files I can just use Topotools to get the gromacs files I need.
Thanks
Indeed, NOW I am trying to do the same myself.
So far, you can use intermol , this should work fine to convert LAMMPS data files to Gromacs files. Once you install intermol, and you ceate a path to the intermol converter, you can use a command like:
python2.7 $conv/convert.py --lmp_in topology.data --gromacs -v
CHECK the format of your data file, I still having problemst to convert it.
If you wish to create the psf file,
you would need VMD (google it), then open the tcl terminal and write :
topo readlammpsdata topology.data full
animate write psf topology.psf
The 1st line is for loading yur LAMMPS data file, if you are in the folder where
that files is located
2nd convert the data to psf CHARMM
Also, you could try this. In this paper, they provide a tood to conver
CHARMM topologies to gromacs here. Thus, you convert to psf, then to gro top.

Scale down PDF page size with Perl

I process PDF files in an existing Perl framework. Some of the incoming files have very large page sizes. What I would like to do:
Check if the input file's page size is larger than a specific format f (A4/Letter)
If it is larger than f: scale it down to f.
This is the corresponding command in Unix using GhostScript:
gs -sPAPERSIZE=a4 -dFIXEDMEDIA -dPSFitPage -o <outputFile> -sDEVICE=pdfwrite <inputFile>
Is there a way to do this within Perl, i.e. without requiring to call external tools?
I checked the modules PDF and CAM::PDF, but the documentation does not really cover my issue and I couldn't find a straight-forward solution.

Error in calling ImageMagick from Matlab

I have installed ImageMagick in my system (windows), and its commands are there in system PATH. Its working absolutely fine through Command line
I want to call the "convert" function of ImageMagick from Matlab using system command.
'C:\Users\Vivek' is the Path to image. I have to test working of ImageMagick through Matlab, as i need it in further processing (Making input suitable to Tesseract OCR)
cmd= ['convert ' 'C:\Users\Vivek\208.jpg ' 'C:\Users\Vivek\208.png']
system(cmd);
It says Invalid Parameter - C:\Users\Vivek\208.png, I tried some other ways. But, all the time the problem is with the second parameters.
Need Help
Thanks
Windows comes with its own convert program, and it looks like you're calling that one because it's first on the path in this context. It's described here on ImageMagick's site: http://www.imagemagick.org/Usage/windows/#convert_issue
I do not have ImageMagick installed, and I get the same error message when I try calling convert. That's consistent with your code getting the wrong convert program.
C:\Users\janke>convert C:\Users\Vivek\286.jpg C:\Users\Vivek\208.png
Invalid Parameter - C:\Users\Vivek\208.png
Specify the full path to ImageMagick's convert program and it should work for you.
The solution mentioned in the last post is the standard way to solve the issue, but the simplest way to do this is to just rename the ImageMagick's convert.exe file to something else, like convert1.exe, and use this filename in your scripts.

Gnuplot incremental filename using macro

Hell,
I need to plot points out of my c++ application.
So I simply save my points to a points.txt
and then run system("gnuplot 'plotmakro'");
which contains:
set output 'plot.png' set terminal png
set grid set multiplot
plot pointsa.txt' ', 'pointb.txt'
Is there a solution so that I get plot2.png, plot3.png when running the makro again?
As far as I understand your problem two possible solutions come to my mind:
sed the output of your gnuplot script to another location before running gnuplot with the newly created script or
output the png to some arbitrary file like tmp_plot.png and change the file name after gnuplot is done to your liking.
However, with both suggestions I somehow feel that there is a nicer and cleaner solution to your problem. Maybe you want to think about your interface between your application an gnuplot...