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

Home » Public Forums » archive » Problem with cgcmdwindow__define
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
Problem with cgcmdwindow__define [message #87631] Thu, 20 February 2014 05:52 Go to next message
seanelvidge is currently offline  seanelvidge
Messages: 11
Registered: January 2013
Junior Member
Hi all (David),

I seem to be having a problem when saving a cgWindow to a Raster image file. I think the problem may be in cgcmdwindow__define. I am trying to save a cgWindow, to a PNG file (although this happens for any file type) however the outputted image is only a single pixel wide.

I believe this is because a WIDTH of 0 is being passed to cgPS_Close (line 2662 in cgcmdwindow__define) which comes from self.im_width. With the width set thus when an N_ELEMENTS check is done during cgPS_Close the program thinks I want to resize the image to something of width 0.

This fault seems to have only arisen recently.


Many thanks with any help you can provide,
Sean.
Re: Problem with cgcmdwindow__define [message #87632 is a reply to message #87631] Thu, 20 February 2014 06:08 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sean Elvidge writes:

> I seem to be having a problem when saving a cgWindow to a Raster image file. I think the problem may be in cgcmdwindow__define. I am trying to save a cgWindow, to a PNG file (although this happens for any file type) however the outputted image is only a single pixel wide.
>
> I believe this is because a WIDTH of 0 is being passed to cgPS_Close (line 2662 in cgcmdwindow__define) which comes from self.im_width. With the width set thus when an N_ELEMENTS check is done during cgPS_Close the program thinks I want to resize the image to something of width 0.
>
> This fault seems to have only arisen recently.

Do you mean from this morning's download of the Coyote Library?

Don't know. This certainly doesn't happen to me when I try it. I guess I
need more details. These are the steps I take to solve these kinds of
problems:

http://www.idlcoyote.com/code_tips/fixcoyoteprogram.php

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Problem with cgcmdwindow__define [message #87633 is a reply to message #87632] Thu, 20 February 2014 06:10 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>
> Sean Elvidge writes:
>
>> I seem to be having a problem when saving a cgWindow to a Raster image file. I think the problem may be in cgcmdwindow__define. I am trying to save a cgWindow, to a PNG file (although this happens for any file type) however the outputted image is only a single pixel wide.
>>
>> I believe this is because a WIDTH of 0 is being passed to cgPS_Close (line 2662 in cgcmdwindow__define) which comes from self.im_width. With the width set thus when an N_ELEMENTS check is done during cgPS_Close the program thinks I want to resize the image to something of width 0.
>>
>> This fault seems to have only arisen recently.
>
> Do you mean from this morning's download of the Coyote Library?
>
> Don't know. This certainly doesn't happen to me when I try it. I guess I
> need more details. These are the steps I take to solve these kinds of
> problems:
>
> http://www.idlcoyote.com/code_tips/fixcoyoteprogram.php

Oh, hang on, you may be right. I was looking at the wrong file.

I'll be back soon. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Problem with cgcmdwindow__define [message #87634 is a reply to message #87633] Thu, 20 February 2014 06:21 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>
> David Fanning writes:
>
>>
>> Sean Elvidge writes:
>>
>>> I seem to be having a problem when saving a cgWindow to a Raster image file. I think the problem may be in cgcmdwindow__define. I am trying to save a cgWindow, to a PNG file (although this happens for any file type) however the outputted image is only a single pixel wide.
>>>
>>> I believe this is because a WIDTH of 0 is being passed to cgPS_Close (line 2662 in cgcmdwindow__define) which comes from self.im_width. With the width set thus when an N_ELEMENTS check is done during cgPS_Close the program thinks I want to resize the image to something of width 0.
>>>
>>> This fault seems to have only arisen recently.
>>
>> Do you mean from this morning's download of the Coyote Library?
>>
>> Don't know. This certainly doesn't happen to me when I try it. I guess I
>> need more details. These are the steps I take to solve these kinds of
>> problems:
>>
>> http://www.idlcoyote.com/code_tips/fixcoyoteprogram.php
>
> Oh, hang on, you may be right. I was looking at the wrong file.
>
> I'll be back soon. :-)

OK, find line 237 in cgWindow_SetDefs. It will look like this:

IF N_Elements(im_width) EQ 0 THEN im_width = 0

Change it to look like this:

IF N_Elements(im_width) EQ 0 THEN im_width = 800

Then, restart IDL. Things should work normally. Although I see a recent
change (may not apply to you) is causing the "height" of this output to
be set to 800, rather than the width. I'll fix this, too, and have new
files available later today, but this might get you going in the right
direction. Thanks for the heads-up.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Problem with cgcmdwindow__define [message #87640 is a reply to message #87631] Thu, 20 February 2014 10:57 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sean Elvidge writes:

> I seem to be having a problem when saving a cgWindow to a Raster image file. I think the problem may be in cgcmdwindow__define. I am trying to save a cgWindow, to a PNG file (although this happens for any file type) however the outputted image is only a single pixel wide.
>
> I believe this is because a WIDTH of 0 is being passed to cgPS_Close (line 2662 in cgcmdwindow__define) which comes from self.im_width. With the width set thus when an N_ELEMENTS check is done during cgPS_Close the program thinks I want to resize the image to something of width 0.
>
> This fault seems to have only arisen recently.

I ended up solving this in a different way from what I recommended this
morning. As I did so, I fixed a bug I had introduced into cgPS2Raster
when I moved some code in the ImageMagick command. I didn't realize
order of the keywords on the command mattered as much as they did. The
result was that the HEIGHT value was being applied to WIDTH in some
cases. While I was fixing *that* program, I just added the HEIGHT
keyword to cgPSClose because, well, why not.

All this to say that several files changed today and you are probably
due for an updated Library anyway:

http://www.idlcoyote.com/programs/zip_files/coyoteprograms.z ip

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Problem with cgcmdwindow__define [message #87658 is a reply to message #87640] Fri, 21 February 2014 00:13 Go to previous message
seanelvidge is currently offline  seanelvidge
Messages: 11
Registered: January 2013
Junior Member
On Thursday, 20 February 2014 18:57:39 UTC, David Fanning wrote:
>
> I ended up solving this in a different way from what I recommended this
> morning. As I did so, I fixed a bug I had introduced into cgPS2Raster
> when I moved some code in the ImageMagick command. I didn't realize
> order of the keywords on the command mattered as much as they did. The
> result was that the HEIGHT value was being applied to WIDTH in some
> cases. While I was fixing *that* program, I just added the HEIGHT
> keyword to cgPSClose because, well, why not.
>
> All this to say that several files changed today and you are probably
> due for an updated Library anyway:
>
> http://www.idlcoyote.com/programs/zip_files/coyoteprograms.z ip
>

Many thanks for the fix David.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: MPFIT2DFUN- use for a time series of images?
Next Topic: Initialize new variable array with nan or -9999 values

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

Current Time: Wed Oct 08 11:43:41 PDT 2025

Total time taken to generate the page: 0.00523 seconds