comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Trouble resizing image
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Trouble resizing image [message #88596] Thu, 15 May 2014 17:01 Go to next message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
I created a large window (1200x700) and am using cgPS_Open/Close to create a PNG file. The intermediate postscript file looks fine, but after the convert command is called, the resulting PNG image is missing the margins and much of the axis labels are cut off. cgSnapShot works fine. Any ideas what I am doing wrong?

The convert command used was

convert -alpha off -density 300 "/home/user/Desktop/test.ps" -flatten -rotate 90 -resize 25% "PNG24:/home/user/Desktop/test.png"


Links to files that are created are:

https://dl.dropboxusercontent.com/u/42944960/test.png
https://dl.dropboxusercontent.com/u/42944960/test.ps
Re: Trouble resizing image [message #88597 is a reply to message #88596] Thu, 15 May 2014 18:05 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matthew Argall writes:

> I created a large window (1200x700) and am using cgPS_Open/Close to create a PNG file. The intermediate postscript file looks fine, but after the convert command is called, the resulting PNG image is missing the margins and much of the axis labels are cut off. cgSnapShot works fine. Any ideas what I am doing wrong?

My guess would be using the Encapsulated keyword, but I would have to
see the command.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Trouble resizing image [message #88598 is a reply to message #88597] Thu, 15 May 2014 18:39 Go to previous messageGo to next message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
> I would have to see the command.

The same thing happens with this:

IDL> window, XSIZE=1200, YSIZE=700
IDL> cgPS_Open, '/home/user/Desktop/test.ps'
PostScript output will be created here: /home/user/Desktop/test.ps
IDL> cgPlot, findgen(100), XTITLE='X-Axis', YTITLE='Y-Axis', TITLE='Title', POSITION=[0.09, 0.1, 0.9, 0.93]
IDL> cgPS_Close, /PNG, /SHOWCMD, DELETE_PS=0
ImageMagick CONVERT command: convert -alpha off -density 300 "/home/user/Desktop/test.ps" -flatten -rotate 90 -resize 25% "PNG24:/Users/argall/Desktop/test.png"
Output file located here: /home/user/Desktop/test.png
Re: Trouble resizing image [message #88599 is a reply to message #88598] Thu, 15 May 2014 19:12 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matthew Argall writes:

> The same thing happens with this:
>
> IDL> window, XSIZE=1200, YSIZE=700
> IDL> cgPS_Open, '/home/user/Desktop/test.ps'
> PostScript output will be created here: /home/user/Desktop/test.ps
> IDL> cgPlot, findgen(100), XTITLE='X-Axis', YTITLE='Y-Axis', TITLE='Title', POSITION=[0.09, 0.1, 0.9, 0.93]
> IDL> cgPS_Close, /PNG, /SHOWCMD, DELETE_PS=0
> ImageMagick CONVERT command: convert -alpha off -density 300 "/home/user/Desktop/test.ps" -flatten -rotate 90 -resize 25% "PNG24:/Users/argall/Desktop/test.png"
> Output file located here: /home/user/Desktop/test.png

Yeah, don't know. Just needs more space, I guess. PostScript output is
not really WYSIWYG. Is there a reason you want the axes so close to the
edge of the plot "window"?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Trouble resizing image [message #88600 is a reply to message #88599] Fri, 16 May 2014 07:11 Go to previous messageGo to next message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
> Is there a reason you want the axes so close to the edge of the plot "window"?

Not really, I guess. I increased the margins and everything is working fine.


I think the problem is similar to one in the link, but I have been playing around for a while and have not been able to get the results I am after. Not familiar enough with IM...

http://stackoverflow.com/questions/14074840/margins-disappea r-in-pdf-png-conversion-with-imagemagick
Re: Trouble resizing image [message #88601 is a reply to message #88600] Fri, 16 May 2014 07:27 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matthew Argall writes:

> I think the problem is similar to one in the link, but I have been playing around for a while and have not been able to get the results I am after. Not familiar enough with IM...
>
> http://stackoverflow.com/questions/14074840/margins-disappea r-in-pdf-png-conversion-with-imagemagick

Yes, sounds like that could be it. You can pass these ImageMagick
command parameters along when you call cgPS_Close or cgPS2Raster, using
the IM_OPTIONS keyword.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How can I force the x=image(...) command to give me a window that is the same size as my image?
Next Topic: Re: Command line history in IDLWAVE shell

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:32:24 PDT 2025

Total time taken to generate the page: 0.00699 seconds