Re: running code via cron changes image output size [message #94475 is a reply to message #94474] |
Fri, 02 June 2017 08:41   |
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
|
|
|