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

Home » Public Forums » archive » No Raster Image via Imagemagick
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
No Raster Image via Imagemagick [message #88977] Wed, 09 July 2014 11:12 Go to next message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
Hello,

I was hoping to save my cgWindow to a publication quality image using Imagemagick. I've run cgHasImageMagick and get

IDL> Print, cgHasImageMagick()
1

but under File, Save Window As... -> I only have the options of Postscript File, PDF File, or Raster Image File. Is there a way to get the Raster Image Files vis ImageMagick from the graphics window or do I need to just save as a postscript and manually convert the file in ImageMagick? I'm using IDL version 8.1.0 on a mac.

Thanks.
-Morgan
Re: No Raster Image via Imagemagick [message #88978 is a reply to message #88977] Wed, 09 July 2014 12:53 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Morgan Silverman writes:

> I was hoping to save my cgWindow to a publication quality image using Imagemagick. I've run cgHasImageMagick and get
>
> IDL> Print, cgHasImageMagick()
> 1
>
> but under File, Save Window As... -> I only have the options of Postscript File, PDF File, or Raster Image File. Is there a way to get the Raster Image Files vis ImageMagick from the graphics window or do I need to just save as a postscript and manually convert the file in ImageMagick? I'm using IDL version 8.1.0 on a mac.

Yes, and ...

Is the resulting image of crappy quality? In my experience, the output
from cgWindow is at least as good as (and sometimes better) than the
output from the function graphics routines.

http://www.idlcoyote.com/cg_tips/compcont.php

What does "publication quality image" mean to you? I use this method to
produce ALL the figures in my books. The books sell well enough to
convince me the figures can't be that bad. ;-)

Do you need to modify the image output? If so, see the keywords to
cgControl.

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: No Raster Image via Imagemagick [message #88979 is a reply to message #88978] Wed, 09 July 2014 12:57 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Is the resulting image of crappy quality? In my experience, the output
> from cgWindow is at least as good as (and sometimes better) than the
> output from the function graphics routines.
>
> http://www.idlcoyote.com/cg_tips/compcont.php

Whoops! This is the link I meant to give you to compare graphics output:

http://www.idlcoyote.com/cg_tips/cgwfg.php

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: No Raster Image via Imagemagick [message #88985 is a reply to message #88978] Thu, 10 July 2014 05:34 Go to previous messageGo to next message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
On Wednesday, July 9, 2014 3:53:43 PM UTC-4, David Fanning wrote:
> Morgan Silverman writes:
>
>
>
>> I was hoping to save my cgWindow to a publication quality image using Imagemagick. I've run cgHasImageMagick and get
>
>>
>
>> IDL> Print, cgHasImageMagick()
>
>> 1
>
>>
>
>> but under File, Save Window As... -> I only have the options of Postscript File, PDF File, or Raster Image File. Is there a way to get the Raster Image Files vis ImageMagick from the graphics window or do I need to just save as a postscript and manually convert the file in ImageMagick? I'm using IDL version 8.1.0 on a mac.
>
>
>
> Yes, and ...
>
>
>
> Is the resulting image of crappy quality? In my experience, the output
>
> from cgWindow is at least as good as (and sometimes better) than the
>
> output from the function graphics routines.
>
>
>
> http://www.idlcoyote.com/cg_tips/compcont.php
>
>
>
> What does "publication quality image" mean to you? I use this method to
>
> produce ALL the figures in my books. The books sell well enough to
>
> convince me the figures can't be that bad. ;-)
>
>
>
> Do you need to modify the image output? If so, see the keywords to
>
> cgControl.
>
>
>
> 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.")

David,

I will certainly take a look at that article. The quality of the output is alright. The problem is I can only save from the graphics window to a postscript and the hardcopy created is different looking then the cgWindow (axis label spacing too close to graph, legend too big, and panel spacing too close). I've tried to save as a Raster File but for some reason nothing is generated and either IDL or my mac actually deletes any previously saved .ps files from cgWindow of the same name. I think the legend resizing problem might be because I used AL_legend,['1500 m', '2000 m', '2500 m', '3000 m', '3500 m'], psym=[28,28,28,28,28], color=['red', 'blue', 'green', 'cyan', 'magenta'], pos=[0.055,0.96], /norm, charsize=0.85. This seemed to be the only method that worked to produce a legend in each panel though. Is there a better way to do that so it doesn't change size in the hardcopy? Maybe not use normalized positions. Thanks.

-Morgan
Re: No Raster Image via Imagemagick [message #88989 is a reply to message #88985] Thu, 10 July 2014 06:53 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Morgan Silverman writes:

> I will certainly take a look at that article. The quality of the output is alright. The problem is I can only save from the graphics window to a postscript and the hardcopy created is different looking then the cgWindow (axis label spacing too close to graph, legend too big, and panel spacing too close). I've tried to save as a Raster File but for some reason nothing is generated and either IDL or my mac actually deletes any previously saved .ps files from cgWindow of
the same name. I think the legend resizing problem might be because I used AL_legend,['1500 m', '2000 m', '2500 m', '3000 m', '3500 m'], psym=[28,28,28,28,28], color=['red', 'blue', 'green', 'cyan', 'magenta'], pos=[0.055,0.96], /norm, charsize=0.85. This seemed to be the only method that worked to produce a legend in each panel though. Is there a better way to do that so it doesn't change size in the hardcopy? Maybe not use normalized positions. Thanks.

You realize, of course, that there is *nothing* like WYSIWYG in IDL,
right? You are using two competely and utterly different display devices
when you draw graphics in a display window and write to a PostScript
file.

That said, Coyote Graphics routines certainly try to create WYSIWYG
displays as much as they can. And, they do a better job of it than
anything else I've seen in IDL. They do this by manipulating such things
as character size and plot and line thickness automatically, but ONLY if
you are not manipulating these things yourself! In other words, if you
let me handle it, I'll do a pretty good job. But, as soon as you start
mucking around with these things, I assume you know what you are doing,
and let you handle it. :-)

Character size is a case in point. When you set your character size to
0.85, that is what you are going to get. But, that means one thing on
the display, and something entirely different in a PostScript file.
Generally speaking, if you want something different from the default,
you will probably have to program it differently, like this:

charsize = (!D.Name EQ 'PS') ? 1.05 : 0.85

Then, you can use your character size in an expression:

cgPlot, data, CHARSIZE=charsize

Positioning things with NORMAL or DATA coordinates is exactly the
*right* thing to do. Don't ever position things with DEVICE coordinates.

I just think you have written your code so that it looks great on the
display, without considering how it will look in PostScript. :-)

Cheers,

David

P.S. By the way, font sizes are handled differently in Coyote Graphics
routines not only by device, but also by machine. Different sizes are
required for Windows as opposed to UNIX computers. See cgDefCharsize for
examples.


--
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: No Raster Image via Imagemagick [message #88990 is a reply to message #88985] Thu, 10 July 2014 07:00 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
By the way, if you want to stop your PostScript file from being deleted
when you create a raster file, use the PS_DELETE keyword to
cgWindow_SetDefs or cgControl:

cgControl, PS_Delete=0

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: No Raster Image via Imagemagick [message #88991 is a reply to message #88990] Thu, 10 July 2014 07:13 Go to previous messageGo to next message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
On Thursday, July 10, 2014 10:00:51 AM UTC-4, David Fanning wrote:
> By the way, if you want to stop your PostScript file from being deleted
>
> when you create a raster file, use the PS_DELETE keyword to
>
> cgWindow_SetDefs or cgControl:
>
>
>
> cgControl, PS_Delete=0
>
>
>
> 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.")

Oh, good to know. Thanks. I guess the moral of the story here is, I need to continually produce PostScript files when plotting to make sure what I'm creating looks good in a hard copy and not just looks good on the screen.
Re: No Raster Image via Imagemagick [message #88992 is a reply to message #88991] Thu, 10 July 2014 07:16 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Morgan Silverman writes:

> Oh, good to know. Thanks. I guess the moral of the story here is, I need to continually produce PostScript files when plotting to make sure what I'm creating looks good in a hard copy and not just looks good on the screen.

Yes, and I think you will find it easier to do outside of a cgWindow.
Now that you have all your graphics commands in a single file, I find it
easier to just do this:

cgPS_Open, 'myfile.png'
DoMyThingWithGraphicsProgram
cgPS_Close

This creates (and deletes) the intermediate PostScript file. The end
result is a PNG file of high quality. :-)

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: No Raster Image via Imagemagick [message #88993 is a reply to message #88992] Thu, 10 July 2014 07:58 Go to previous messageGo to next message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
On Thursday, July 10, 2014 10:16:51 AM UTC-4, David Fanning wrote:
> Morgan Silverman writes:
>
>
>
>> Oh, good to know. Thanks. I guess the moral of the story here is, I need to continually produce PostScript files when plotting to make sure what I'm creating looks good in a hard copy and not just looks good on the screen.
>
>
>
> Yes, and I think you will find it easier to do outside of a cgWindow.
>
> Now that you have all your graphics commands in a single file, I find it
>
> easier to just do this:
>
>
>
> cgPS_Open, 'myfile.png'
>
> DoMyThingWithGraphicsProgram
>
> cgPS_Close
>
>
>
> This creates (and deletes) the intermediate PostScript file. The end
>
> result is a PNG file of high quality. :-)
>
>
>
> 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.")

How do I go backwards now and go outside of a cgWindow? I wrote 6 procedures, 1 for each panel, and am running them in a main code using...

cgWindow, 'DAQPanel1', wtitle='Plot6PanelTraj_MOZAICpaper', wxsize=800, wysize=800, WBackground='White'
cgWindow, 'DAQPanel2', wtitle='Plot6PanelTraj_MOZAICpaper', wxsize=800, wysize=800, WBackground='White', /AddCmd
cgWindow, 'DAQPanel3', wtitle='Plot6PanelTraj_MOZAICpaper', wxsize=800, wysize=800, WBackground='White', /AddCmd
cgWindow, 'MOZAICPanel1', wtitle='Plot6PanelTraj_MOZAICpaper', wxsize=800, wysize=800, WBackground='White', /AddCmd
cgWindow, 'MOZAICPanel2', wtitle='Plot6PanelTraj_MOZAICpaper', wxsize=800, wysize=800, WBackground='White', /AddCmd
cgWindow, 'MOZAICPanel3', wtitle='Plot6PanelTraj_MOZAICpaper', wxsize=800, wysize=800, WBackground='White', /AddCmd

To use cgPS_Open do I need to recreate my graphics just in a normal cgDisplay window?

-Morgan
Re: No Raster Image via Imagemagick [message #88994 is a reply to message #88992] Thu, 10 July 2014 09:57 Go to previous message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
On Thursday, July 10, 2014 10:16:51 AM UTC-4, David Fanning wrote:
> Morgan Silverman writes:
>
>
>
>> Oh, good to know. Thanks. I guess the moral of the story here is, I need to continually produce PostScript files when plotting to make sure what I'm creating looks good in a hard copy and not just looks good on the screen.
>
>
>
> Yes, and I think you will find it easier to do outside of a cgWindow.
>
> Now that you have all your graphics commands in a single file, I find it
>
> easier to just do this:
>
>
>
> cgPS_Open, 'myfile.png'
>
> DoMyThingWithGraphicsProgram
>
> cgPS_Close
>
>
>
> This creates (and deletes) the intermediate PostScript file. The end
>
> result is a PNG file of high quality. :-)
>
>
>
> 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.")

Yes, of course. I just put all my procedure codes (without the procedure lines) and still using cgLayout I'm able to plot and output to a png file nicely :-) Now to just figure out how to resize everything correctly (both graphs and page size).
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: improve calculation time
Next Topic: computation time for convolution

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

Current Time: Wed Oct 08 11:53:51 PDT 2025

Total time taken to generate the page: 0.00886 seconds