Re: Help with ps2raster Cutting Off Image

"Kwok, Marcus B." <[email protected]> Thu, 14 Aug 2014 13:22:25 +0000
Newsgroups gmane.comp.gis.gmt.user
Message-ID <[email protected]>
--_000_78feb22dcbe54df4840a431cbd39615baplex05dom1jhuapledu_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

OK thanks anyway! I will try upgrading.

--
Marcus Kwok <[email protected]<mailto:[email protected]>>
Johns Hopkins University Applied Physics Laboratory, AOS QAT Group
Office: 21-S233I          Mailstop: 21-S246
Phone: (443) 778-7858 (Baltimore) or (240) 228-7858 (DC)

From: World-Wide GMT Usage and Help Mailing List [mailto:[email protected]=
aii.edu] On Behalf Of Paul Wessel
Sent: Wednesday, August 13, 2014 18:12
To: [email protected]
Subject: Re: [GMT-HELP] Help with ps2raster Cutting Off Image

Cannot really reproduce this since 4.5.2 was some time ago.  The eps stuff =
was yanked as we could not do a good job without full access to font metric=
s.  So better to use more recent GMT and specify the paper size you want.  =
You can use an exact custom papersize to impose your own boundingbox, or us=
e ps2raster -A if you want a tight one.

-p

On Aug 13, 2014, at 11:05 AM, Kwok, Marcus B. <[email protected]<mailt=
o:[email protected]>> wrote:


Hello,
I am programmatically generating an EPS file using GMT, and then converting=
 it to PNG using ghostscript.  However, when I use ps2raster, part of the f=
ile gets cut off.

I have reduced my "script" to a pretty minimal example that demonstrates my=
 issue.  The size of the image is supposed to represent a letter-size (8.5"=
x11") sheet of paper, with "UNCLASSIFIED" printed in the top right and bott=
om left corners (in the production map, there are additional annotations on=
 the page as well).  After running ps2raster, the "UNCLASSIFIED" at the top=
 of the image gets cut off, and the margin on the right side of the map is =
now smaller.

pscoast -R-180.0/180.0/-60.0/90.0 -B30g15/30g15 --PLOT_DEGREE_FORMAT=3DdddF=
 --DEGREE_SYMBOL=3Ddegree -JQ0.0/8.5i  -G178/255/178 -S130/239/255 -Dc -W -=
K --PAPER_MEDIA=3Dletter+ > test.eps

pstext classification.txt -JX8.5i/6.5i -R-4.25/4.25/0/6.5 -N -O --PAPER_MED=
IA=3Dletter+ >> test.eps

ps2raster test.eps -E72 -Qt4 -Tg

gswin32c -q -dNOPAUSE -dBATCH -sDEVICE=3Dpng16m -r72 -dTextAlphaBits=3D4 -s=
OutputFile=3Dgs.png -ftest.eps

Here are the contents of the classification.txt file:
-4.25 -0.5 12 0 0 TC UNCLASSIFIED
4.25 7 12 0 0 BC UNCLASSIFIED

When I run gswin32c directly, the entire image is visible, so I have a work=
around in place.

I have attached my sample output (the PNG files have been rotated manually =
to the correct orientation, as my application handles that automatically).

I am using (an admittedly old version) GMT 4.5.2, but I don't think it is a=
 bug, but more so that I am doing something incorrectly when creating the f=
ile or the annotations.  Is there a way to specify the BoundingBox to ps2ra=
ster?

Thanks,
Marcus

--
Marcus Kwok <[email protected]<mailto:[email protected]>>
Johns Hopkins University Applied Physics Laboratory, AOS QAT Group
Office: 21-S233I          Mailstop: 21-S246
Phone: (443) 778-7858 (Baltimore) or (240) 228-7858 (DC)

Mailing list for GMT discussions of all kinds. If you are not sure you have=
 found a bug, discuss it here first. To formally report bugs or request fea=
tures, please register and add New Issue on gmt.soest.hawaii.edu<http://gmt=
.soest.hawaii.edu> To unsubscribe, send the message "signoff gmt-help" to l=
[email protected]<mailto:[email protected]> Note: gmt-help w=
ill become obsolete on Sept 1, 2014 - please use forum on gmt.soest.hawaii.=
edu<http://gmt.soest.hawaii.edu> instead. <test.eps><test.png><gs.png>

Mailing list for GMT discussions of all kinds. If you are not sure you have=
 found a bug, discuss it here first. To formally report bugs or request fea=
tures, please register and add New Issue on gmt.soest.hawaii.edu To unsubsc=
ribe, send the message "signoff gmt-help" to [email protected]<mail=
to:[email protected]> Note: gmt-help will become obsolete on Sept 1=
, 2014 - please use forum on gmt.soest.hawaii.edu instead.

Mailing list for GMT discussions of all kinds.  If you are not sure you have found a bug, discuss it here first.
To formally report bugs or request features, please register and add New Issue on gmt.soest.hawaii.edu
To unsubscribe, send the message "signoff gmt-help" to [email protected]
Note: gmt-help will become obsolete on Sept 1, 2014 - please use forum on gmt.soest.hawaii.edu instead.

--_000_78feb22dcbe54df4840a431cbd39615baplex05dom1jhuapledu_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
span.EmailStyle18
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"blue" vlink=3D"purple">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"color:#1F497D">OK thanks anyway! I wi=
ll try upgrading.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"color:#1F497D"><o:p>&nbsp;</o:p></spa=
n></p>
<div>
<p class=3D"MsoNormal"><span style=3D"color:#1F497D">-- <o:p></o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"color:#1F497D">Marcus Kwok &lt;<a hre=
f=3D"mailto:[email protected]">[email protected]</a>&gt;<o:p></o:=
p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:8.0pt;color:#1F497D">Johns =
Hopkins University Applied Physics Laboratory,&nbsp;AOS QAT Group<o:p></o:p=
></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:8.0pt;color:#1F497D">Office=
: 21-S233I&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mailstop: =
21-S246<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:8.0pt;color:#1F497D">Phone:=
 (443) 778-7858 (Baltimore) or (240) 228-7858 (DC)</span><span style=3D"col=
or:#1F497D"><o:p></o:p></span></p>
</div>
<p class=3D"MsoNormal"><span style=3D"color:#1F497D"><o:p>&nbsp;</o:p></spa=
n></p>
<div>
<div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in =
0in 0in">
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:&quot=
;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style=3D"font-s=
ize:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> World-Wi=
de GMT Usage and Help Mailing List [mailto:[email protected]]
<b>On Behalf Of </b>Paul Wessel<br>
<b>Sent:</b> Wednesday, August 13, 2014 18:12<br>
<b>To:</b> [email protected]<br>
<b>Subject:</b> Re: [GMT-HELP] Help with ps2raster Cutting Off Image<o:p></=
o:p></span></p>
</div>
</div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Cannot really reproduce this since 4.5.2 was some ti=
me ago. &nbsp;The eps stuff was yanked as we could not do a good job withou=
t full access to font metrics. &nbsp;So better to use more recent GMT and s=
pecify the paper size you want. &nbsp;You can use
 an exact custom papersize to impose your own boundingbox, or use ps2raster=
 -A if you want a tight one.<o:p></o:p></p>
<div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class=3D"MsoNormal">-p<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<p class=3D"MsoNormal">On Aug 13, 2014, at 11:05 AM, Kwok, Marcus B. &lt;<a=
 href=3D"mailto:[email protected]">[email protected]</a>&gt; wrot=
e:<o:p></o:p></p>
</div>
<p class=3D"MsoNormal"><br>
<br>
<o:p></o:p></p>
<div>
<p class=3D"MsoNormal">Hello,<o:p></o:p></p>
<p class=3D"MsoNormal">I am programmatically generating an EPS file using G=
MT, and then converting it to PNG using ghostscript.&nbsp; However, when I =
use ps2raster, part of the file gets cut off.<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">I have reduced my &#8220;script&#8221; to a pretty m=
inimal example that demonstrates my issue.&nbsp; The size of the image is s=
upposed to represent a letter-size (8.5&#8221;x11&#8221;) sheet of paper, w=
ith &#8220;UNCLASSIFIED&#8221; printed in the top right and bottom left cor=
ners
 (in the production map, there are additional annotations on the page as we=
ll).&nbsp; After running ps2raster, the &#8220;UNCLASSIFIED&#8221; at the t=
op of the image gets cut off, and the margin on the right side of the map i=
s now smaller.<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">pscoast -R-180.0/180.0/-60.0/90.0 -B30g15/30g15 --PL=
OT_DEGREE_FORMAT=3DdddF --DEGREE_SYMBOL=3Ddegree -JQ0.0/8.5i&nbsp; -G178/25=
5/178 -S130/239/255 -Dc -W -K --PAPER_MEDIA=3Dletter&#43; &gt; test.eps<o:p=
></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">pstext classification.txt -JX8.5i/6.5i -R-4.25/4.25/=
0/6.5 -N -O --PAPER_MEDIA=3Dletter&#43; &gt;&gt; test.eps<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">ps2raster test.eps -E72 -Qt4 -Tg<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">gswin32c -q -dNOPAUSE -dBATCH -sDEVICE=3Dpng16m -r72=
 -dTextAlphaBits=3D4 -sOutputFile=3Dgs.png -ftest.eps<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">Here are the contents of the classification.txt file=
:<o:p></o:p></p>
<p class=3D"MsoNormal">-4.25 -0.5 12 0 0 TC UNCLASSIFIED<o:p></o:p></p>
<p class=3D"MsoNormal">4.25 7 12 0 0 BC UNCLASSIFIED<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">When I run gswin32c directly, the entire image is vi=
sible, so I have a workaround in place.<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">I have attached my sample output (the PNG files have=
 been rotated manually to the correct orientation, as my application handle=
s that automatically).<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">I am using (an admittedly old version) GMT 4.5.2, bu=
t I don&#8217;t think it is a bug, but more so that I am doing something in=
correctly when creating the file or the annotations.&nbsp; Is there a way t=
o specify the BoundingBox to ps2raster?<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">Thanks,<o:p></o:p></p>
<p class=3D"MsoNormal">Marcus <o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">-- <o:p></o:p></p>
<p class=3D"MsoNormal">Marcus Kwok &lt;<a href=3D"mailto:marcus.kwok@jhuapl=
.edu">[email protected]</a>&gt;<o:p></o:p></p>
<p class=3D"MsoNormal"><span style=3D"font-size:8.0pt">Johns Hopkins Univer=
sity Applied Physics Laboratory,&nbsp;AOS QAT Group</span><o:p></o:p></p>
<p class=3D"MsoNormal"><span style=3D"font-size:8.0pt">Office: 21-S233I&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mailstop: 21-S246</span>=
<o:p></o:p></p>
<p class=3D"MsoNormal"><span style=3D"font-size:8.0pt">Phone: (443) 778-785=
8 (Baltimore) or (240) 228-7858 (DC)</span><o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;<o:p></o:p></p>
</div>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt;font-family:&quot;Ti=
mes New Roman&quot;,&quot;serif&quot;">Mailing list for GMT discussions of =
all kinds. If you are not sure you have found a bug, discuss it here first.=
 To formally report bugs or request features, please register
 and add New Issue on <a href=3D"http://gmt.soest.hawaii.edu">gmt.soest.haw=
aii.edu</a> To unsubscribe, send the message &quot;signoff gmt-help&quot; t=
o
<a href=3D"mailto:[email protected]">[email protected]</a> =
Note: gmt-help will become obsolete on Sept 1, 2014 - please use forum on
<a href=3D"http://gmt.soest.hawaii.edu">gmt.soest.hawaii.edu</a> instead. &=
lt;test.eps&gt;&lt;test.png&gt;&lt;gs.png&gt;<o:p></o:p></span></p>
</div>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt;font-family:&quot;Ti=
mes New Roman&quot;,&quot;serif&quot;"><o:p>&nbsp;</o:p></span></p>
</div>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt;font-family:&quot;Ti=
mes New Roman&quot;,&quot;serif&quot;">Mailing list for GMT discussions of =
all kinds. If you are not sure you have found a bug, discuss it here first.=
 To formally report bugs or request features, please register
 and add New Issue on gmt.soest.hawaii.edu To unsubscribe, send the message=
 &quot;signoff gmt-help&quot; to
<a href=3D"mailto:[email protected]">[email protected]</a> =
Note: gmt-help will become obsolete on Sept 1, 2014 - please use forum on g=
mt.soest.hawaii.edu instead.
<o:p></o:p></span></p>
</div>
</body>
</html>
Mailing list for GMT discussions of all kinds.  If you are not sure you have found a bug, discuss it here first.
To formally report bugs or request features, please register and add New Issue on gmt.soest.hawaii.edu
To unsubscribe, send the message &quot;signoff gmt-help&quot; to <a href=3D"mailto:[email protected]">[email protected]</a>
Note: gmt-help will become obsolete on Sept 1, 2014 - please use forum on gmt.soest.hawaii.edu instead.

--_000_78feb22dcbe54df4840a431cbd39615baplex05dom1jhuapledu_--