<div dir="ltr"><div><span style="font-size:12.8000001907349px">Hi </span><span style="font-size:12.8000001907349px">jean pierre huart,</span><br></div><div style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px"><br></span></div><div style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">I have exported png image using module "d.out.file",(I have pasted a part of the script below which I have used. I hope this will help you....</span></div><div style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">.......................................................</span></div><div style="font-size:12.8000001907349px"><div><span style="font-size:12.8000001907349px">import grass.script as g</span></div><div><span style="font-size:12.8000001907349px">import os</span></div><div><span style="font-size:12.8000001907349px">import shutil</span></div><div><span style="font-size:12.8000001907349px">import time</span></div></div><div style="font-size:12.8000001907349px"><div><span style="font-size:12.8000001907349px">g.run_command('r.colors',map=str(i),rules='color_table.txt')</span></div><div><span style="font-size:12.8000001907349px"> g.start_command('d.mon', start='wx1')</span></div><div><span style="font-size:12.8000001907349px"> time.sleep(10)</span></div><div><span style="font-size:12.8000001907349px"> g.run_command('d.rast', map=str(i))</span></div><div><span style="font-size:12.8000001907349px"> time.sleep(10)</span></div><div><span style="font-size:12.8000001907349px"> g.run_command('d.vect', map=str(i))</span></div><div><span style="font-size:12.8000001907349px"> time.sleep(40)</span></div><div><span style="font-size:12.8000001907349px"> g.run_command('d.out.file',output=str(i),format='png',size=(2403,2403))</span></div><div><span style="font-size:12.8000001907349px"> time.sleep(10)</span></div><div><span style="font-size:12.8000001907349px"> g.run_command('d.mon', stop='wx1')</span></div><div><span style="font-size:12.8000001907349px"> time.sleep(10)</span></div><div style="font-size:12.8000001907349px">.................................................................</div></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Regards,</div><div style="font-size:12.8000001907349px">Vinay</div><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
<br>
1. How to define the png image dimensions when using d.mon?<br>
(jean pierre huart)<br>
2. Re: How to define the png image dimensions when using d.mon?<br>
(jean pierre huart)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 8 Mar 2016 16:15:01 +0100<br>
From: jean pierre huart <<a href="mailto:jph@openjph.be" target="_blank">jph@openjph.be</a>><br>
To: <a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
Subject: [GRASS-user] How to define the png image dimensions when<br>
using d.mon?<br>
Message-ID: <<a href="mailto:56DEEC75.5030709@openjph.be" target="_blank">56DEEC75.5030709@openjph.be</a>><br>
Content-Type: text/plain; charset=iso-8859-15; format=flowed<br>
<br>
Hello,<br>
<br>
I've written a python script to generate an image combining a vector map<br>
(myvector) and a raster (myraster) that has been generated using a mask.<br>
It works great by default and creates an image with the default<br>
dimensions 640x480 on a white background.<br>
<br>
gscript.run_command('d.mon', overwrite=True, start='png',<br>
output=filename)<br>
gscript.run_command('d.rast', map='{0}@{1}'.format(myraster,<br>
self.mapset))<br>
gscript.run_command('d.vect', map='{0}@{1}'.format(myvector,<br>
self.mapset), color='white', fill_color='none')<br>
gscript.run_command('d.mon', stop="png")<br>
<br>
I would like to have a transparent background and to change the<br>
dimensions of the image to 1280x960.<br>
Reading the documentation I had the impression that I just have to<br>
modify some variables, but it does not work.<br>
<br>
os.environ['GRASS_TRANSPARENT'] = 'TRUE'<br>
os.environ['GRASS_WIDTH'] = str(1280)<br>
os.environ['GRASS_HEIGHT'] = str(960)<br>
gscript.run_command('d.mon', overwrite=True, start='png',<br>
output=filename)<br>
gscript.run_command('d.rast', map='{0}@{1}'.format(myraster,<br>
self.mapset))<br>
gscript.run_command('d.vect', map='{0}@{1}'.format(myvector,<br>
self.mapset), color='white', fill_color='none')<br>
gscript.run_command('d.mon', stop="png")<br>
<br>
Thanks in advance for any advice.<br>
Ciao<br>
<br>
--<br>
Jean Pierre Huart<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Tue, 8 Mar 2016 16:28:35 +0100<br>
From: jean pierre huart <<a href="mailto:jph@openjph.be" target="_blank">jph@openjph.be</a>><br>
To: <a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
Subject: Re: [GRASS-user] How to define the png image dimensions when<br>
using d.mon?<br>
Message-ID: <<a href="mailto:56DEEFA3.2050007@openjph.be" target="_blank">56DEEFA3.2050007@openjph.be</a>><br>
Content-Type: text/plain; charset=utf-8; format=flowed<br>
<br>
Sorry I've forgotten to precise that I'm using Grass v7.0.3 on ubuntu 14.04.<br>
<br>
On 08/03/16 16:15, jean pierre huart wrote:<br>
> Hello,<br>
><br>
> I've written a python script to generate an image combining a vector<br>
> map (myvector) and a raster (myraster) that has been generated using a<br>
> mask.<br>
> It works great by default and creates an image with the default<br>
> dimensions 640x480 on a white background.<br>
><br>
> gscript.run_command('d.mon', overwrite=True, start='png',<br>
> output=filename)<br>
> gscript.run_command('d.rast', map='{0}@{1}'.format(myraster,<br>
> self.mapset))<br>
> gscript.run_command('d.vect', map='{0}@{1}'.format(myvector,<br>
> self.mapset), color='white', fill_color='none')<br>
> gscript.run_command('d.mon', stop="png")<br>
><br>
> I would like to have a transparent background and to change the<br>
> dimensions of the image to 1280x960.<br>
> Reading the documentation I had the impression that I just have to<br>
> modify some variables, but it does not work.<br>
><br>
> os.environ['GRASS_TRANSPARENT'] = 'TRUE'<br>
> os.environ['GRASS_WIDTH'] = str(1280)<br>
> os.environ['GRASS_HEIGHT'] = str(960)<br>
> gscript.run_command('d.mon', overwrite=True, start='png',<br>
> output=filename)<br>
> gscript.run_command('d.rast', map='{0}@{1}'.format(myraster,<br>
> self.mapset))<br>
> gscript.run_command('d.vect', map='{0}@{1}'.format(myvector,<br>
> self.mapset), color='white', fill_color='none')<br>
> gscript.run_command('d.mon', stop="png")<br>
><br>
> Thanks in advance for any advice.<br>
> Ciao<br>
><br>
<br>
--<br>
Jean Pierre Huart<br>
<br>
OpenJph<br>
19, rue de la fontaine<br>
1340 Ottignies<br>
web: <a href="http://www.openjph.be" rel="noreferrer" target="_blank">www.openjph.be</a><br>
email: <a href="mailto:jph@openjph.be" target="_blank">jph@openjph.be</a><br>
tel: <a href="tel:%2B32%20487%2095%2077%2075" value="+32487957775" target="_blank">+32 487 95 77 75</a><br>
skype: jeanpierre.huart<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
<br>
------------------------------<br>
<br>
End of grass-user Digest, Vol 119, Issue 12<br>
*******************************************<br>
</blockquote></div><br></div></div>