[Image-SIG] less disk IO

Carl Karsten carl at personnelware.com
Thu Jan 3 04:43:58 CET 2008

Douglas Bagnall wrote:
> Carl Karsten wrote:
>> I am trying to convert a pdf (data in string, not disk file) to a png.  This 
>> will be run in a django view on a server (PyCon's even) so it would be good if 
>> it didn't hit the disk as much.  Shouldn't I be able to use .tostring if I can 
>> use .save?
> use cStringIO.

I saw some mention of that in the IM docs.  any idea why .tostring doesn't work?

> It might not make much difference, because your OS should be caching the
> file in memory anyway, and letting you read it back before it is
> actually written to disk.

busy server, so if I can easily make it better...

Also, keeping everything in memory means nothing to clean up when things crash. 
    which happens often enough, that if I can make it better...

> If you are sure it is a disk problem, you could set it up to write to a
> ram file system (e.g. tmpfs on linux), which would help the PDF
> conversion too.

well, not sure.  just a feeling and some comments from an admin.
make it better... :)
> Otherwise you could see if it possible to communicate with the convert
> script using pipes, rather than system(). That will cut out a few reads
> and writes.

I hear pipes aren't thread safe, and/or can deadlock the web server.  no time to 
  figure that out, so i am just avoiding it.

also, I just discovered http://packages.ubuntu.com/hardy/python/python-pythonmagick

but I can't find docs.  any suggestions?

(not sure if I will be able to install this package on the server it needs to be 
on, so I am going to try to spend less than 30 min on it ... might happen ;)

Carl K

> Douglas
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig

More information about the Image-SIG mailing list