librelist archives

« back to archive

draw takes 1 min to execute in cgi environment

draw takes 1 min to execute in cgi environment

From:
Sergei G
Date:
2013-09-11 @ 05:31
I am testing a small script that generates a text on top of the image.
There is nothing special in there. If I run script from command line it
executes without any delay. If I run from apache in cgi environment (on my
mac os x), then draw operation takes a whole minute to execute.

I think it has something to do with execution as _www user instead of my
standard user id.

Here is the code sample:

            with Image(filename=previewFileName) as original:
                with Drawing() as draw:
                    draw.font_size = 60
                    draw.text_alignment = 'center'
                    draw.text(original.width / 2, original.height / 3,
phrase)
                    logger.debug('calling draw...')
                    draw(original)
                    logger.debug('draw is done.')
                logger.debug('making blob...')
                data = original.make_blob()
                logger.debug('blob is done.')

Here is log output:

2013-09-10 22:19:01,534 DEBUG: calling draw...
2013-09-10 22:20:01,091 DEBUG: draw is done

I don't think it is related to python layer. I just hope that some of you
may know the proper configuration. I used Mac ports to install ImageMagick.

note that I don't set font yet as I have not figured out where font
location is and what font options I have available.


Thank you

Re: draw takes 1 min to execute in cgi environment

From:
Sergei G
Date:
2013-09-11 @ 17:16
After I made sure that HOME has a proper value, the draw started to work as
fast as in other environments. HOME was not set in cgi environment.

I have had MAGICK_HOME properly configured at all times.


On Tue, Sep 10, 2013 at 10:31 PM, Sergei G <sergeig.public@gmail.com> wrote:

> I am testing a small script that generates a text on top of the image.
> There is nothing special in there. If I run script from command line it
> executes without any delay. If I run from apache in cgi environment (on my
> mac os x), then draw operation takes a whole minute to execute.
>
> I think it has something to do with execution as _www user instead of my
> standard user id.
>
> Here is the code sample:
>
>             with Image(filename=previewFileName) as original:
>                 with Drawing() as draw:
>                     draw.font_size = 60
>                     draw.text_alignment = 'center'
>                     draw.text(original.width / 2, original.height / 3,
> phrase)
>                     logger.debug('calling draw...')
>                     draw(original)
>                     logger.debug('draw is done.')
>                 logger.debug('making blob...')
>                 data = original.make_blob()
>                 logger.debug('blob is done.')
>
> Here is log output:
>
> 2013-09-10 22:19:01,534 DEBUG: calling draw...
> 2013-09-10 22:20:01,091 DEBUG: draw is done
>
> I don't think it is related to python layer. I just hope that some of you
> may know the proper configuration. I used Mac ports to install ImageMagick.
>
> note that I don't set font yet as I have not figured out where font
> location is and what font options I have available.
>
>
> Thank you
>