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

Home » Public Forums » archive » Re: 8-bit Postscript problem (Will IDL and color Postscript *ever* get along?)
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
Re: 8-bit Postscript problem (Will IDL and color Postscript *ever* get along?) [message #49198] Fri, 07 July 2006 11:06 Go to next message
M-K is currently offline  M-K
Messages: 3
Registered: July 2006
Junior Member
M-K wrote:

> The program works correctly on my X11 display, so I had actually
> been writing it to a png file and using ImageMagick ('convert') to
> make Postscript files. {Not bad, except for publications (and
> dissertation), the fonts are kinda marginal (no pun intended). }
>
> Thanks so much for your response (as well as the great progs
> you've made); here is a code example I used to generate a plot
> which can be converted to white-on-black Postscript:

oops- I meant black (print) on white (background), thus the
color=0 and BACKGROUND=-1 statements...

> TVImage, BYTSCL(wavgy[*,0:nz/06],MIN=-w_amp,MAX=w_amp), $
> /ERASE, POSITION=[.12,.12,.8,.9], /MINUS_ONE, BACKGROUND=-1
> contour, wavgy[*,0:nz/06], x, z[0:nz/06], xtitle="x (m)", ytitle="z (m)", $
> title=textoidl('vertical velocity field (ms^{-1}), \alpha_{fall}=0.5'), $
> chars=1.5, /NODATA, /NOERASE, POS=[.12,.12,.8,.9], color=0
> colorbar, /vertical, /right, NCOLORS=256, POSITION=[0.83,0.15,0.85,0.85], $
> RANGE=[-w_amp,w_amp],DIVISIONS=4, charsize=1.5, FORMAT='(F6.2)',
> color=0
>
> (the PNG file is then saved using your SAVEIMAGE prog, and converted
> using the -white-threshold and other options with the ImageMagick/convert
> linux goodie).
Re: 8-bit Postscript problem (Will IDL and color Postscript *ever* get along?) [message #49200 is a reply to message #49198] Fri, 07 July 2006 09:21 Go to previous messageGo to next message
M-K is currently offline  M-K
Messages: 3
Registered: July 2006
Junior Member
David Fanning wrote:
> [ M. Kelly writes:
>
>> Hello, I know this subject has (had) come up many times for over a
>> decade, and from what I can
>> tell on this newsgroup, seemed to be worked out to a great extent by
>> say 2004.
>>
>> My problem is a 'classic' (?) where color postscript output is only 16
>> colors. That is, I'm
>> trying to make a Postscript color image, but I get 'blocky' colors -
>> i.e., only 16 of them.
>>
>> But the twist (or me missing something) is that
>> 1) I am using David Fanning's flexible TVIMAGE program (thanks!
>> great prog btw),
>> and
>> 2) I explicitly set DEVICE, BITS=8, COLOR=1, ENCAPSULATED=1 after
>> doing SET_PLOT,'ps'.
>>
>> A curious thing, though: using Fanning's COLORBAR program produces
>> 256-color output on the
>> Postscript plot, so the bar looks nice and the plot is
>> crude/blocky/pixelly/ick. Also, doing a LOADCT
>> after setting to PS output does not help.
>>
>> Could anyone help or offer any suggestions for this seemingly
>> ancient/solved problem? ]
>
> Humm. If everything is as you say it is, and COLORBAR
> works correctly, then I would say the problem is with
> your image. Does your program work correctly on your
> display? I would guess your image is not byte scaled,
> from the available evidence. (I would like to see the
> code, however.)

The program works correctly on my X11 display, so I had actually
been writing it to a png file and using ImageMagick ('convert') to
make Postscript files. {Not bad, except for publications (and
dissertation), the fonts are kinda marginal (no pun intended). }

Thanks so much for your response (as well as the great progs
you've made); here is a code example I used to generate a plot
which can be converted to white-on-black Postscript:

TVImage, BYTSCL(wavgy[*,0:nz/06],MIN=-w_amp,MAX=w_amp), /ERASE, $
POSITION=[.12,.12,.8,.9], /MINUS_ONE, BACKGROUND=-1
contour, wavgy[*,0:nz/06], x, z[0:nz/06], xtitle="x (m)", ytitle="z
(m)", $
title=textoidl('vertical velocity field (ms^{-1}),
\alpha_{fall}=0.5'), $
chars=1.5, /NODATA, /NOERASE, POS=[.12,.12,.8,.9], color=0
colorbar, /vertical, /right, NCOLORS=256,
POSITION=[0.83,0.15,0.85,0.85], $
RANGE=[-w_amp,w_amp],DIVISIONS=4, charsize=1.5, FORMAT='(F6.2)',
color=0

(the PNG file is then saved using your SAVEIMAGE prog, and converted
using
the -white-threshold and other options with the ImageMagick/convert
linux goodie).

thanks again, much and mucho,
-Mark
Re: 8-bit Postscript problem (Will IDL and color Postscript *ever* get along?) [message #49202 is a reply to message #49200] Fri, 07 July 2006 05:17 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
M. Kelly writes:

> Hello, I know this subject has (had) come up many times for over a
> decade, and from what I can
> tell on this newsgroup, seemed to be worked out to a great extent by
> say 2004.
>
> My problem is a 'classic' (?) where color postscript output is only 16
> colors. That is, I'm
> trying to make a Postscript color image, but I get 'blocky' colors -
> i.e., only 16 of them.
>
> But the twist (or me missing something) is that
> 1) I am using David Fanning's flexible TVIMAGE program (thanks!
> great prog btw),
> and
> 2) I explicitly set DEVICE, BITS=8, COLOR=1, ENCAPSULATED=1 after
> doing SET_PLOT,'ps'.
>
> A curious thing, though: using Fanning's COLORBAR program produces
> 256-color output on the
> Postscript plot, so the bar looks nice and the plot is
> crude/blocky/pixelly/ick. Also, doing a LOADCT
> after setting to PS output does not help.
>
> Could anyone help or offer any suggestions for this seemingly
> ancient/solved problem?

Humm. If everything is as you say it is, and COLORBAR
works correctly, then I would say the problem is with
your image. Does your program work correctly on your
display? I would guess your image is not byte scaled,
from the available evidence. (I would like to see the
code, however.)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: 8-bit Postscript problem (Will IDL and color Postscript *ever* get along?) [message #49261 is a reply to message #49198] Tue, 11 July 2006 10:31 Go to previous message
M-K is currently offline  M-K
Messages: 3
Registered: July 2006
Junior Member
David Fanning wrote:

> Humm. Very strange. I guess I still believe you haven't set the BITS_PER_PIXEL
> keyword correctly in PostScript, even though you write that you have, etc.
> But it is the only thing I can think of that still makes any sense. I would just
> check that DEVICE command again one more time (and perhaps confirm that
> the option got set with a Help, /Device).

Oddly, doing
set_plot, 'ps' & !P.Font=0
DEVICE, BITS_PER_PIXEL=8, COLOR=1, FILE=fnam, $
/ENCAPS, XSIZE=7,YSIZE=4,/INCHES
Help,/DEVICE

confirms 8 bits per pixel; the output is:

Current graphics device: PS
Mode: Portrait, Encapsulated, EPSI Preview Disabled, Color Enabled
Output Color Model: RGB
... { offset, size, preview stuff here, Scale Factor is 1 }
...
Font: Helvetica TrueType Font: <default>
# bits per image pixel: 8
Font Mapping: ...

So somehow the colorbar output is nice, but the TVImage output
is pixelly or not enough colors, despite BITS_PER_PIXEL=8.
Could there be a pixel scaling problem with Postscript?

Thank you again,
-Mark
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Reading Binary
Next Topic: 8-bit Postscript problem (Will IDL and color Postscript *ever* get along?)

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

Current Time: Wed Oct 08 16:00:28 PDT 2025

Total time taken to generate the page: 0.00937 seconds