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