Main Page | Report Page

 

  Computers Forum Index » Computer Languages (IDL-PVWAVE) » PostScript and TrueColor images...

Author Message
nata...
Posted: Fri Oct 22, 2010 4:49 pm
 
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
 
nata...
Posted: Fri Oct 22, 2010 5:39 pm
 
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
 
nata...
Posted: Fri Oct 22, 2010 6:01 pm
 
I'm using IDL 7.0
Sometimes IDL makes me nervous with this kind of things.

Thanks a lot David,
nata
 
Karl...
Posted: Fri Oct 22, 2010 6:45 pm
 
On Oct 22, 10:49 am, nata <bernat.puigdomen... at (no spam) gmail.com> wrote:
Quote:
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"?
 
nata...
Posted: Fri Oct 22, 2010 6:59 pm
 
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.
 
Karl...
Posted: Fri Oct 22, 2010 7:16 pm
 
On Oct 22, 12:59 pm, nata <bernat.puigdomen... at (no spam) gmail.com> wrote:
Quote:
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.
 
Karl...
Posted: Fri Oct 22, 2010 8:03 pm
 
On Oct 22, 1:25 pm, David Fanning <n... at (no spam) dfanning.com> wrote:
Quote:
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.
 
David Fanning...
Posted: Fri Oct 22, 2010 8:55 pm
 
nata writes:

Quote:
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...

I don't believe you. Really!? :-)

What does "very different" mean? Like the values have
been run though a color table when they weren't suppose
to be? Try loading the gray-scale color table first in
your PostScript file. Does that help?

What version of IDL are you using?

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.")
 
David Fanning...
Posted: Fri Oct 22, 2010 9:44 pm
 
nata writes:

Quote:
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.")
 
David Fanning...
Posted: Fri Oct 22, 2010 10:21 pm
 
nata writes:

Quote:
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.")
 
David Fanning...
Posted: Fri Oct 22, 2010 10:36 pm
 
David Fanning writes:

Quote:
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. Smile

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. Sad
I made sure !P.FONT=0 and ran it again. Still not rotated. Sad :-(

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.")
 
David Fanning...
Posted: Fri Oct 22, 2010 11:25 pm
 
Karl writes:

Quote:
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.")
 
David Fanning...
Posted: Sat Oct 23, 2010 12:04 am
 
Karl writes:

Quote:
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.")
 
Kenneth P. Bowman...
Posted: Sat Oct 23, 2010 1:40 am
 
In article <MPG.272b87ac86448f769897e6 at (no spam) news.giganews.com>,
David Fanning <news at (no spam) dfanning.com> wrote:

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

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

What kind of amphetamines are you using?

Ken Bowman
 
mgalloy...
Posted: Sat Oct 23, 2010 1:55 am
 
On 10/22/10 3:40 PM, Kenneth P. Bowman wrote:
Quote:
In article<MPG.272b87ac86448f769897e6 at (no spam) news.giganews.com>,
David Fanning<news at (no spam) 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
 
 
Page 1 of 2    Goto page 1, 2  Next
All times are GMT
The time now is Thu Jul 24, 2014 10:49 am