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

Home » Public Forums » archive » Re: More cgplot, ps_start, ps_end problems
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: More cgplot, ps_start, ps_end problems [message #75240] Sun, 20 February 2011 06:34
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Feb 19, 5:12 pm, David Fanning <n...@idlcoyote.com> wrote:
> Gray writes:
>> OK, I've updated.  The .EPS files look great.  The PNG files, however,
>> still do not exist... :(
>
> Do you think it is a problem expanding the "~" in the
> file name? What happens when you give it an absolute
> file name?
>
> 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.")

That was it. Easy fix! Thanks again! :)
Re: More cgplot, ps_start, ps_end problems [message #75243 is a reply to message #75240] Sat, 19 February 2011 14:12 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gray writes:

> OK, I've updated. The .EPS files look great. The PNG files, however,
> still do not exist... :(

Do you think it is a problem expanding the "~" in the
file name? What happens when you give it an absolute
file name?

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.")
Re: More cgplot, ps_start, ps_end problems [message #75244 is a reply to message #75243] Sat, 19 February 2011 14:11 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Carsten Lechte writes:

> in my eps-output procedures and it has always worked. I have, however, given up on
> landscape ps output.

FixPS from my web page has solved all my landscape
PostScript problems:

http://www.idlcoyote.com/ps_tips/landscapeup.html

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.")
Re: More cgplot, ps_start, ps_end problems [message #75245 is a reply to message #75244] Sat, 19 February 2011 13:24 Go to previous message
Carsten Lechte is currently offline  Carsten Lechte
Messages: 124
Registered: August 2006
Senior Member
David Fanning wrote:
> I seem to recall something about problems with IDL
> encapsulated PostScript output, but I can't put my
> finger on it. Does anyone remember? I am running
> IDL 7.1.1 on Windows

I am using IDL 6.4 on Linux 64bit, and eps output works relatively painlessly.
I use something like

!P.FONT=0
SET_PLOT, 'PS'
DEVICE, FILENAME=fname
DEVICE, /ENCAPSULATED
DEVICE, /COLOR
DEVICE, BITS_PER_PIXEL=8
DEVICE, XSIZE=sizes[0], YSIZE=sizes[1]

plot stuff

DEVICE, /CLOSE_FILE
SPAWN, 'convert -transparent white -density 400 '+fname+' '+fname+'.png'

in my eps-output procedures and it has always worked. I have, however, given up on
landscape ps output.

I also get weird corrupted (as in "ghostscript cannot render it beyond the first page")
output when doing multipage, non-encapsulated ps. I will post about it if I can
reproduce the problem.


chl
Re: More cgplot, ps_start, ps_end problems [message #75246 is a reply to message #75245] Sat, 19 February 2011 13:21 Go to previous message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Feb 19, 3:43 pm, David Fanning <n...@idlcoyote.com> wrote:
> David Fanning writes:
>> Hang on, I haven't updated this yet! I'll let you know.
>
> OK, now you can update. :-)
>
> 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.")

OK, I've updated. The .EPS files look great. The PNG files, however,
still do not exist... :(
Re: More cgplot, ps_start, ps_end problems [message #75247 is a reply to message #75246] Sat, 19 February 2011 12:43 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Hang on, I haven't updated this yet! I'll let you know.

OK, now you can update. :-)

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.")
Re: More cgplot, ps_start, ps_end problems [message #75248 is a reply to message #75247] Sat, 19 February 2011 12:21 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gray writes:

> OK, so after /nomatch the .eps file looks fine, but ImageMagick still
> can't find it to convert to a PNG... I'll update my CG and try
> again! :)

Hang on, I haven't updated this yet! I'll let you know.

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.")
Re: More cgplot, ps_start, ps_end problems [message #75249 is a reply to message #75248] Sat, 19 February 2011 12:10 Go to previous message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Feb 19, 2:59 pm, Gray <grayliketheco...@gmail.com> wrote:
> On Feb 19, 1:35 pm, David Fanning <n...@idlcoyote.com> wrote:
>
>
>
>
>
>
>
>
>
>> David Fanning writes:
>>> Well, actually, it appears ImageMagick is struggling a bit
>>> with encapsulated PostScript files. I'll have to look into
>>> this some more. I've never tried to turn encapsulated
>>> PostScript files into raster files, so I don't know what
>>> that problem might be.
>
>> I am beginning to suspect that the encapsulated PostScript
>> files IDL produces might be the culprit here. Here is what
>> I have done.
>
>> I created a simple encapsulated PostScript file in IDL.
>> I tried to read this file in Adobe Illustrator. I couldn't
>> open it.
>
>> I opened another similar image file in Adobe Illustrator
>> and saved that as an encapsulated PostScript file.
>> ImageMagick had no difficulty creating a PNG file from
>> that encapsulated PostScript file.
>
>> I created an encapsulated PostScript file from an iPlot,
>> and tried to open this in Adobe Illustrator. It complained
>> about a missing font, but it opened the file just fine.
>> This file was also able to be converted to a PNG file
>> by ImageMagick just fine.
>
>> So, the culprit seems to be the traditional PostScript
>> device driver.
>
>> I seem to recall something about problems with IDL
>> encapsulated PostScript output, but I can't put my
>> finger on it. Does anyone remember? I am running
>> IDL 7.1.1 on Windows
>
>> 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.")
>
> OOOOh... /NOMATCH should definitely help.  Oops.  Thanks!

OK, so after /nomatch the .eps file looks fine, but ImageMagick still
can't find it to convert to a PNG... I'll update my CG and try
again! :)
Re: More cgplot, ps_start, ps_end problems [message #75250 is a reply to message #75249] Sat, 19 February 2011 11:59 Go to previous message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Feb 19, 1:35 pm, David Fanning <n...@idlcoyote.com> wrote:
> David Fanning writes:
>> Well, actually, it appears ImageMagick is struggling a bit
>> with encapsulated PostScript files. I'll have to look into
>> this some more. I've never tried to turn encapsulated
>> PostScript files into raster files, so I don't know what
>> that problem might be.
>
> I am beginning to suspect that the encapsulated PostScript
> files IDL produces might be the culprit here. Here is what
> I have done.
>
> I created a simple encapsulated PostScript file in IDL.
> I tried to read this file in Adobe Illustrator. I couldn't
> open it.
>
> I opened another similar image file in Adobe Illustrator
> and saved that as an encapsulated PostScript file.
> ImageMagick had no difficulty creating a PNG file from
> that encapsulated PostScript file.
>
> I created an encapsulated PostScript file from an iPlot,
> and tried to open this in Adobe Illustrator. It complained
> about a missing font, but it opened the file just fine.
> This file was also able to be converted to a PNG file
> by ImageMagick just fine.
>
> So, the culprit seems to be the traditional PostScript
> device driver.
>
> I seem to recall something about problems with IDL
> encapsulated PostScript output, but I can't put my
> finger on it. Does anyone remember? I am running
> IDL 7.1.1 on Windows
>
> 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.")

OOOOh... /NOMATCH should definitely help. Oops. Thanks!
Re: More cgplot, ps_start, ps_end problems [message #75251 is a reply to message #75250] Sat, 19 February 2011 11:48 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> I am beginning to suspect that the encapsulated PostScript
> files IDL produces might be the culprit here.

OK, here is another reason I love IDL. Even though
you have worked with it daily for 25 years, you can
*still* learn something new about it!

I am completely wrong about all of this. :-)

IDL's PostScript driver works correctly, as far
as I can tell.

The thing is, if you are going to create encapsulated
PostScript files, you want to turn LANDSCAPE off and
PORTRAIT on, and you want to set XOFFSET and YOFFSET
to zeros. Then, *everyone* is happy with the result,
including ImageMagick and Adobe Illustrator. I was not
aware of this until about 10 minutes ago, as hard as
that is for all of us to believe!

Anyway, I have made the require modifications to PS_Start,
but I want to also make the modifications to PSConfig,
as well as update some error handling.

With the modifications, then Gray's plot will work
perfectly, no matter how he chooses to create it. :-)

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.")
Re: More cgplot, ps_start, ps_end problems [message #75252 is a reply to message #75251] Sat, 19 February 2011 10:35 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Well, actually, it appears ImageMagick is struggling a bit
> with encapsulated PostScript files. I'll have to look into
> this some more. I've never tried to turn encapsulated
> PostScript files into raster files, so I don't know what
> that problem might be.

I am beginning to suspect that the encapsulated PostScript
files IDL produces might be the culprit here. Here is what
I have done.

I created a simple encapsulated PostScript file in IDL.
I tried to read this file in Adobe Illustrator. I couldn't
open it.

I opened another similar image file in Adobe Illustrator
and saved that as an encapsulated PostScript file.
ImageMagick had no difficulty creating a PNG file from
that encapsulated PostScript file.

I created an encapsulated PostScript file from an iPlot,
and tried to open this in Adobe Illustrator. It complained
about a missing font, but it opened the file just fine.
This file was also able to be converted to a PNG file
by ImageMagick just fine.

So, the culprit seems to be the traditional PostScript
device driver.

I seem to recall something about problems with IDL
encapsulated PostScript output, but I can't put my
finger on it. Does anyone remember? I am running
IDL 7.1.1 on Windows

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.")
Re: More cgplot, ps_start, ps_end problems [message #75253 is a reply to message #75252] Sat, 19 February 2011 10:03 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gray writes:

> Weird... I just used PS_START and PS_END to create .eps files... but
> ImageMagick can't find the .eps files to convert to PNGs when I have
> PS_END, /PNG set. Here's the output from PS_END:
>
> PostScript output will be created here: ~/Desktop/BrGamma_known.eps
> ImageMagick CONVRT command:
> convert -alpha off -density 300 "~/Desktop/BrGamma_known.eps" -resize
> 25% -flatten -rotate 90 "PNG24:~/Desktop/BrGamma_known.png"
> convert: unable to open image `~/Desktop/BrGamma_known.eps': No such
> file or directory @ error/blob.c/OpenBlob/2584
> convert: missing an image filename `PNG:~/Desktop/BrGamma_known.png' @
> error/convert.c/ConvertImageCommand/2949
>
> I get the .eps file on the desktop, and the image size is correct, but
> the plot isn't centered, it runs off the end, and the rotation is
> wrong.
>
> My last CG update is from a couple of days ago. Here's the routine
> that produces the plots:
>
> PRO knownplot, filt, nb, res, id, typ
> ps_start, file='~/Desktop/'+filt+'_known.eps',$
> /encapsulate,/inches,xsize=10,ysize=10
> cgplot, nb, res-nb, psym=1, xtitle=filt+' NB mag',$
> ytitle=filt+' Diff mag - NB mag',title+'Known WRs in '+$
> filt, charsize=1.25
> cgtext, nb, res-nb, typ, charsize=0.7, charthick=2, /data
> ps_end, /png
> end

OK, let me try this again.

The purpose of PS_Start is to allow you to create PostScript
output that matches the output you see in a display window.
So, by default it looks at the current graphics window,
determines that window's aspect ratio (or uses the default
aspect ratio, if a graphics window isn't open), and then
creates a window with that aspect ratio, centered, on
a PostScript "page". If the graphics window is wider than
it is tall, the PostScript "page" is assumed to be in
landscape mode. Otherwise, it assumes the page is in
portrait mode.

Now, you don't *have* to use PS_Start in default mode.
You can choose to override this default behavior. If you
do, you MUST set the NOMATCH keyword, so it does not
match the aspect ratio of the current graphics window.
And, if you choose to override this default behavior, I
presume (maybe you are reading my new book!) you know
something about how the PostScript device works. In other
words, you know how to set sizes and offsets that get your
PostScript "window" somewhere where you will actually be
able to see it when you "print" the PostScript page.
(Presumably this is the point of making a PostScript file.)

If you don't know much about how the PostScript device works,
then I recommend you set the GUI keyword on PS_Start and
use PSConfig to set up your PostScript page. If you did that
in this case, you would see pretty clearly that a 10 inch
by 10 inch square does NOT fit on an 8.5 by 11 inch PostScript
page with the default offsets! In other words, you would
would have to select some other page size to fit the size
of the window you want to create.

So, if fooled around long enough with PSConfig to get what
you wanted, then PS_End would know *exactly* what it is you
are trying to do, know that what you chose was "legal" in the
sense that something sensible could result from it, and I have
great confidence that the PNG file made from such a sensible
PostScript file would also look pretty darn good. :-)

Something like this would work:

ps_start, file='~/Desktop/'+filt+'_known.eps', $
/encapsulate,/inches,xsize=10,ysize=10, $
pagetype='ledger', xoffset=0.5, yoffset=13.5, $
/landscape, /gui

Well, actually, it appears ImageMagick is struggling a bit
with encapsulated PostScript files. I'll have to look into
this some more. I've never tried to turn encapsulated
PostScript files into raster files, so I don't know what
that problem might be.

While I am investigating, I think I'll add more error
handling to PSConfig to warn users that what they are
trying to do is not likely to work. :-)

I'll get back to you about ImageMagick and conversion
of encapsulated PostScript files.

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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Music production, Anyone?!
Next Topic: Re: ncdf + x-connection + many files = crazy.

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

Current Time: Wed Oct 08 15:36:45 PDT 2025

Total time taken to generate the page: 0.00506 seconds