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

Home » Public Forums » archive » running code via cron changes image output size
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
running code via cron changes image output size [message #94474] Fri, 02 June 2017 06:52 Go to next message
Brian McNoldy is currently offline  Brian McNoldy
Messages: 35
Registered: July 2000
Member
I have been struggling with a very obscure and odd issue. I have code that utilizes the function graphics (map, scatterplot, colorbar, text... nothing weird). I also use the buffer keyword so no windows open.

When I run the code manually in the DE, the image that gets saved (via "m.save,filename,border=5,resolution=100") is 1295x487 pixels. Fine.

I also have the code set to run via a script that can be called by cron. When I run the script myself (via ./run_script.sh), the image that gets saved is 1295x487 pixels. Great.

But when I allow cron to run the same script, the image that gets saved is 1297x488. Why?? I have literally zero ideas why that would make a difference, and I need them to be the same (aside from brute-forcing a resize after-the-fact).

I'd be happy to provide any other details if they're helpful in solving this.

Cheers,
Brian
Re: running code via cron changes image output size [message #94475 is a reply to message #94474] Fri, 02 June 2017 08:41 Go to previous messageGo to next message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On 06/02/2017 03:52 PM, Brian McNoldy wrote:
> I have been struggling with a very obscure and odd issue. I have
> code that utilizes the function graphics (map, scatterplot, colorbar,
> text... nothing weird). I also use the buffer keyword so no windows
> open.
>
> When I run the code manually in the DE, the image that gets saved
> (via "m.save,filename,border=5,resolution=100") is 1295x487 pixels.
> Fine.
>
> I also have the code set to run via a script that can be called by
> cron. When I run the script myself (via ./run_script.sh), the image
> that gets saved is 1295x487 pixels. Great.
>
> But when I allow cron to run the same script, the image that gets
> saved is 1297x488. Why?? I have literally zero ideas why that would
> make a difference, and I need them to be the same (aside from
> brute-forcing a resize after-the-fact).
>
> I'd be happy to provide any other details if they're helpful in
> solving this.

I don't know about CRON, but using the BUFFER keyword can change the
size, or rather not using it crops it to display size.

Have you tried fixing the graphic size by using

m=map(.....,DIMENSIONS=[width, height]); ?

Probably does not solve the underlying problem, but might be sufficient
as a workaround.


Another approach, don't set the BORDER keyword of the SAVE method.
If the graphic contains different content, setting the BORDER keyword
can result in different output sizes, e.g. if the axis labels take up a
different amount of space. The reason for that can be that the labels
show different numbers (eg 100 vs 10) or use a different font.


By the way, any chance the different sizes could be caused by an
environment variable, that is different depending on whether the script
is started as a CRON job or directly in the terminal?


I hope one of the above approaches helps, if not more details might be
required so we can help you. Unless someone else has an idea....

Good luck, Markus
Re: running code via cron changes image output size [message #94476 is a reply to message #94475] Fri, 02 June 2017 09:59 Go to previous message
Brian McNoldy is currently offline  Brian McNoldy
Messages: 35
Registered: July 2000
Member
On Friday, June 2, 2017 at 11:41:03 AM UTC-4, Markus Schmassmann wrote:
> On 06/02/2017 03:52 PM, Brian McNoldy wrote:
>> I have been struggling with a very obscure and odd issue. I have
>> code that utilizes the function graphics (map, scatterplot, colorbar,
>> text... nothing weird). I also use the buffer keyword so no windows
>> open.
>>
>> When I run the code manually in the DE, the image that gets saved
>> (via "m.save,filename,border=5,resolution=100") is 1295x487 pixels.
>> Fine.
>>
>> I also have the code set to run via a script that can be called by
>> cron. When I run the script myself (via ./run_script.sh), the image
>> that gets saved is 1295x487 pixels. Great.
>>
>> But when I allow cron to run the same script, the image that gets
>> saved is 1297x488. Why?? I have literally zero ideas why that would
>> make a difference, and I need them to be the same (aside from
>> brute-forcing a resize after-the-fact).
>>
>> I'd be happy to provide any other details if they're helpful in
>> solving this.
>
> I don't know about CRON, but using the BUFFER keyword can change the
> size, or rather not using it crops it to display size.
>
> Have you tried fixing the graphic size by using
>
> m=map(.....,DIMENSIONS=[width, height]); ?
>
> Probably does not solve the underlying problem, but might be sufficient
> as a workaround.
>
>
> Another approach, don't set the BORDER keyword of the SAVE method.
> If the graphic contains different content, setting the BORDER keyword
> can result in different output sizes, e.g. if the axis labels take up a
> different amount of space. The reason for that can be that the labels
> show different numbers (eg 100 vs 10) or use a different font.
>
>
> By the way, any chance the different sizes could be caused by an
> environment variable, that is different depending on whether the script
> is started as a CRON job or directly in the terminal?
>
>
> I hope one of the above approaches helps, if not more details might be
> required so we can help you. Unless someone else has an idea....
>
> Good luck, Markus

Markus,

I do have a size specified in the initial call to MAP, so that is a constant among all the methods.

I tried removing "border" from SAVE and that seemed to do the trick. Now the image is created at 1303x488 px if I run the code manually or let cron do it. The positions and fonts of everything are hard-coded, so the image should never need to be a different size when it runs.

I'm happy to have a solution, but frustrated to not understand why! :-)

Thank you, Markus!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Image registration
Next Topic: NARR Lambert Conformal Conic projection to lat lon projection conversion

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

Current Time: Wed Oct 08 07:14:19 PDT 2025

Total time taken to generate the page: 0.00421 seconds