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

Home » Public Forums » archive » Re: PostScript and TrueColor images
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: PostScript and TrueColor images [message #73054] Fri, 22 October 2010 15:40
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Kenneth P. Bowman writes:

> By the way, are you really writing ten book pages per day?

I didn't get that many in today, but, yes, that's my goal.
When I know what I am talking about, I can do this. When
I only *think* I know what I'm talking about, but don't
really, it slows me down a bit.

This first book is really just an extended IDL programming
course. I've taught those so many times I can almost
do it blindfolded. There is a natural progression of
the material from simple to complicated. I don't usually
get stuck until I'm about half way though a lecture. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: PostScript and TrueColor images [message #73055 is a reply to message #73054] Fri, 22 October 2010 14:55 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 10/22/10 3:40 PM, Kenneth P. Bowman wrote:
> In article<MPG.272b87ac86448f769897e6@news.giganews.com>,
> David Fanning<news@dfanning.com> wrote:
>
>> No wonder people who don't use my software run around
>> with confused looks all the time. :-)
>
> By the way, are you really writing ten book pages per day?
>
> What kind of amphetamines are you using?
>
> Ken Bowman

Yes, that's quite a pace!

Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
Re: PostScript and TrueColor images [message #73056 is a reply to message #73055] Fri, 22 October 2010 14:40 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <MPG.272b87ac86448f769897e6@news.giganews.com>,
David Fanning <news@dfanning.com> wrote:

> No wonder people who don't use my software run around
> with confused looks all the time. :-)

By the way, are you really writing ten book pages per day?

What kind of amphetamines are you using?

Ken Bowman
Re: PostScript and TrueColor images [message #73057 is a reply to message #73056] Fri, 22 October 2010 13:04 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Karl writes:

> But nata said that loading the grey-scale ramp didn't help. So, I
> don't know at this point.

No, I think it said it worked, in his strange sort of way. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: PostScript and TrueColor images [message #73058 is a reply to message #73057] Fri, 22 October 2010 13:03 Go to previous message
Karl[1] is currently offline  Karl[1]
Messages: 79
Registered: October 2005
Member
On Oct 22, 1:25 pm, David Fanning <n...@dfanning.com> wrote:
> Karl writes:
>> They try setting /decomposed, /color in your device command when using
>> the 'ps' device.
>
> Well, that will work in the 24-bit PostScript device, which
> really only got working properly in IDL 7.1. It will complain
> bitterly in versions of IDL before that. :-)
>
> Load a gray-scale color table. Problem solved.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Yes, and of course I noted too late that nata was using IDL 7.0.

But nata said that loading the grey-scale ramp didn't help. So, I
don't know at this point.
Re: PostScript and TrueColor images [message #73059 is a reply to message #73058] Fri, 22 October 2010 12:25 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Karl writes:

> They try setting /decomposed, /color in your device command when using
> the 'ps' device.

Well, that will work in the 24-bit PostScript device, which
really only got working properly in IDL 7.1. It will complain
bitterly in versions of IDL before that. :-)

Load a gray-scale color table. Problem solved.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: PostScript and TrueColor images [message #73060 is a reply to message #73059] Fri, 22 October 2010 12:16 Go to previous message
Karl[1] is currently offline  Karl[1]
Messages: 79
Registered: October 2005
Member
On Oct 22, 12:59 pm, nata <bernat.puigdomen...@gmail.com> wrote:
> The maximum value for BITS is 8
>
> BITS_PER_PIXEL
>
> (PS)
>
> IDL is capable of producing PostScript images with 1, 2, 4, or 8 bits
> per pixel. Using more bits per pixel gives higher resolution at the
> cost of generating larger files. BITS_PER_PIXEL is used to specify the
> number of bits to use. If you do not specify a value for
> BITS_PER_PIXEL, a default value of 4 is used.
>
> It should be noted that many laser printers, including the original
> Apple Laserwriter are capable of only 32 different shades of gray
> (which can be represented by 5 bits). Thus, specifying 8 bits per
> pixel does not give 256 apparent shades of grey as might be expected,
> only 32, at a cost of sending twice the number of bits to the printer.
> Often, 4 bits (16 levels of gray) will give acceptable results with a
> large savings in file size.

OK. My bad.

They try setting /decomposed, /color in your device command when using
the 'ps' device.

You used decomposed when using the X device. And Mike Galloy's web
site has a sample of using 24-bit ps and sets /decomposed.
Re: PostScript and TrueColor images [message #73061 is a reply to message #73060] Fri, 22 October 2010 11:59 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
The maximum value for BITS is 8


BITS_PER_PIXEL

(PS)

IDL is capable of producing PostScript images with 1, 2, 4, or 8 bits
per pixel. Using more bits per pixel gives higher resolution at the
cost of generating larger files. BITS_PER_PIXEL is used to specify the
number of bits to use. If you do not specify a value for
BITS_PER_PIXEL, a default value of 4 is used.

It should be noted that many laser printers, including the original
Apple Laserwriter are capable of only 32 different shades of gray
(which can be represented by 5 bits). Thus, specifying 8 bits per
pixel does not give 256 apparent shades of grey as might be expected,
only 32, at a cost of sending twice the number of bits to the printer.
Often, 4 bits (16 levels of gray) will give acceptable results with a
large savings in file size.
Re: PostScript and TrueColor images [message #73062 is a reply to message #73061] Fri, 22 October 2010 11:57 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Karl writes:

> Why are you saying "bits=8"?
> This might imply bits per pixel and you have 24-bits of image data.
> I'm not real sure how the PS device works in this respect, but you
> might be knocking 24-bits of color information down to 8 bits, which
> would certainly make the image look different. Try "bits=24"?

From the IDL documentation (I know):

When writing TrueColor images to a PostScript file, the
BITS_PER_PIXEL value applies to each channel of the image.
Thus, to write a 24-bit image, which consists of three
8-bit image planes, set BITS_PER_PIXEL=8.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: PostScript and TrueColor images [message #73063 is a reply to message #73062] Fri, 22 October 2010 11:45 Go to previous message
Karl[1] is currently offline  Karl[1]
Messages: 79
Registered: October 2005
Member
On Oct 22, 10:49 am, nata <bernat.puigdomen...@gmail.com> wrote:
> Hi guys,
>
> I have a RGB image [1024,1024,3] and I do:
>
> ----------------------------------------
> set_plot, 'x'
> device, decomposed=1
> tv, image, true=3
> ----------------------------------------
>
> The image is perfect. Then I do:
>
> ----------------------------------------
> set_plot, 'ps'
> device, /color, bits=8, filename='example.ps'
> tv, image, true=3
> device, /close
> ----------------------------------------
>
> The final PostScript file contains an image very different. The colors
> are not the same and I don't know why...
> Any suggestions,
>
> nata

Why are you saying "bits=8"?
This might imply bits per pixel and you have 24-bits of image data.
I'm not real sure how the PS device works in this respect, but you
might be knocking 24-bits of color information down to 8 bits, which
would certainly make the image look different. Try "bits=24"?
Re: PostScript and TrueColor images [message #73064 is a reply to message #73063] Fri, 22 October 2010 11:36 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Well, you're not the only one. I'll reserve a copy of my
> next book for you. All of this is explained in tiresome
> detail there. :-)

Speaking of which, I ran into an interesting PostScript
problem yesterday that I had forgotten I knew anything
about! :-)

I test the code in my book by pasting it to the IDL
command line. When it works the way it is suppose to
I call PS_Start, paste the code, call PS_End with the PNG
keyword set, and bam! I have a perfect PNG file to import
into the book file. Extremely easy and I make sure the
book is free of code typos, too.

So, I was working on the Surface Plot chapter yesterday,
and all was going normally (you know, SLOWLY), when I
decided that one of the surface plots I came up with
was so nice that I should make it a candidate for the
cover of the book. So I wanted to make it a larger
size.

Rather than use PS_Start, I just thought I would configure
the PostScript device myself with PSConfig. So I did and
ran my programs and the surface labels weren't rotated. :-(
I made sure !P.FONT=0 and ran it again. Still not rotated. :-( :-(

Eventually, I had to look at PS_Start to see what the heck it
was doing! Setting !P.Font to 1, of course, because only
Hershey and True-Type fonts can be rotated in PostScript in
this 3D way. Wow. I've been using PS_Start for so long I
forgot all about that.

No wonder people who don't use my software run around
with confused looks all the time. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: PostScript and TrueColor images [message #73066 is a reply to message #73064] Fri, 22 October 2010 11:21 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
nata writes:

> I'm using IDL 7.0
> Sometimes IDL makes me nervous with this kind of things.

Well, you're not the only one. I'll reserve a copy of my
next book for you. All of this is explained in tiresome
detail there. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: PostScript and TrueColor images [message #73067 is a reply to message #73066] Fri, 22 October 2010 11:01 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
I'm using IDL 7.0
Sometimes IDL makes me nervous with this kind of things.

Thanks a lot David,
nata
Re: PostScript and TrueColor images [message #73070 is a reply to message #73067] Fri, 22 October 2010 10:44 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
nata writes:

> If I load the grey-scale palette the result is the same...
> I don't see what is happening because the image contains the color
> values so, why loading the grey-scale palette I obtain another
> result ?

What version of IDL is this?

Up until IDL 7, I think, IDL had this insane notion
on some machines (Windows, for sure) that when you
were in indexed color mode ALL images should pass though
the color table vectors, even images that already had
their colors specified directly!!

Naturally, this is NOT what anyone, anywhere wanted to
do. This has since been fixed, but it still makes it
difficult to display images correctly. It is one reason
why I haven't used a TV command since about 1998. TVImage
or ImgDisp is your friend, here, Nata!

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: PostScript and TrueColor images [message #73071 is a reply to message #73070] Fri, 22 October 2010 10:39 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Lool !

If I load the grey-scale palette the result is the same...
I don't see what is happening because the image contains the color
values so, why loading the grey-scale palette I obtain another
result ?
Thanks David,

nata
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: GetLastChild
Next Topic: SVD on CUDA

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

Current Time: Wed Oct 08 19:39:36 PDT 2025

Total time taken to generate the page: 0.00627 seconds