Simpler Raster Output [message #86738] |
Fri, 29 November 2013 17:10  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
I'm still avoiding real work today. I was thinking about Paul's comment
about the "stuff we put up with" earlier this week and I realized I have
been putting up with something mildly annoying for a long time. I
decided to do something about it.
My practice is to write graphics programs that display themselves on my
computer, but when I want to share my results with a colleague, or put
the results on my web page, I create a raster file by doing something
like this:
cgPS_Open, 'myplot.ps'
... whatever the graphics command is here...
cgPS_Close, /PNG
This creates a PostScript file (which I don't need) and converts it to a
PNG file (in this case, but it could be JPEG, or TIFF, or PDF) with the
same "base name" as the PostScript file (e.g, "myplot.png").
Over time, I have found myself typing the filename as "myplot.png"
because that, in fact, is what I want. So, today, I just made that
change.
Now, when I want a JPEG file of the graphics command, I do this:
cgPS_Open, 'myfile.jpg'
... whatever the graphics command is here...
cgPS_Close
The file "myfile.jpg" is created, the intermediate PostScript file is
deleted automatically, and I have *exactly* what I want. Ah, it feels SO
good! ;-)
You can get the updated Coyote Library files (from just moments ago, not
the one I announced earlier today) here:
http://www.idlcoyote.com/programs/zip_files/coyotelibrary.zi p
Of course, these commands also work like they always did. So, if your
fingers are already trained, no worries.
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: Simpler Raster Output [message #86749 is a reply to message #86738] |
Sun, 01 December 2013 08:42  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> Now, when I want a JPEG file of the graphics command, I do this:
>
> cgPS_Open, 'myfile.jpg'
> ... whatever the graphics command is here...
> cgPS_Close
>
> The file "myfile.jpg" is created, the intermediate PostScript file is
> deleted automatically, and I have *exactly* what I want. Ah, it feels SO
> good! ;-)
>
> You can get the updated Coyote Library files (from just moments ago, not
> the one I announced earlier today) here:
>
> http://www.idlcoyote.com/programs/zip_files/coyotelibrary.zi p
>
> Of course, these commands also work like they always did. So, if your
> fingers are already trained, no worries.
Yikes! I made a knuckle-head mistake yesterday. I forgot to test my
programs in a *fresh* IDL session. I'm afraid cgPS_Open is not going to
work if you downloaded yesterday's distribution. I've put a new
distribution up this morning.
http://www.idlcoyote.com/programs/zip_files/coyotelibrary.zi p
Sorry about that. :-(
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.")
|
|
|