Coyote Graphics Raster File Output [message #79771] |
Tue, 03 April 2012 09:14 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
One of the tenets of Coyote Graphics is that if and when
you create raster file output from a graphics window, it should
look as much as possible like the contents of the graphics
window (in truth, it will look much *better*). As you know,
this is done via PostScript intermediary files with
raster conversion via ImageMagick.
The way I have been doing it results in raster file
output that is *approximately* the size of your
graphics window, but there was no exact control
over the dimensions of the final raster file.
This lack of control has made it difficult to produce
graphical output for inclusion on web pages, where
I would like all images sized to the same relative
dimensions.
To address this problem, I have added a new IM_WIDTH
keyword to PS_END. With this keyword, you can specify
the final output width of raster file output created
with ImageMagick. For example, these commands will
now result in an output PNG file that is exactly 800
pixels wide:
PS_Start
cgHistoplot, cgDemodata(7), /Fill
PS_End, /PNG, IM_WIDTH=800
The height will be adjusted automatically to maintain
the correct aspect ratio of the output (thus, preserving
the Coyote Graphics tenet described above).
The IM_WIDTH keyword has been extended to *all* the
Coyote Graphics routines that create raster output via
ImageMagick. So, for example, if you want *all* your
raster files to have a width of 725 pixels, you could
set it up like this:
cgWindow_SetDefs, IM_WIDTH=725
Now, if you created a plot and made a raster file out
of it, it would be exactly 725 pixels wide:
cgPlot, cgDemodata(1), Output='myplot.png'
Or, you could put a plot in a resizeable graphics window and
direct all the raster file output from that window to be
650 pixels wide:
cgContour, cgDemoData(2), /Fill, /Outline, /Window
cgControl, IM_WIDTH=650
Note that using cgWindow_SetDefs to set the width will also
apply to cgWindow output. Set the IM_WIDTH keyword to 0
to turn off this feature:
cgWindow_SetDefs, IM_WIDTH=0
Changes have been made to 13 Coyote Graphics files to implement
this new feature. This would be a good time to update your
Coyote Library. :-)
http://www.idlcoyote.com/programs/coyoteprograms.zip
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|