It is often necessary to provide string representation of the instances of different classes. Application of this can be found in debugging, dumping in a file, communication across the network, etc. Several functions in the object class of Python can be overriden to output appropriate string representations. I'm listing a few bellow:
__str__()
returns an informal string representation of an object. Does not necessarily has to be a valid python expression.
__repr__()
this function can be overriden to output a valid Python string. This is called by the builtin repr() function which, returns the python representation of an object. Since this is often used in debugging, it is suggested to be information rich.
Jul 28, 2013
Jul 1, 2013
Creating GIF animation in Ubuntu
From the manual of 'covert'
The convert program is a member of the ImageMagick(1) suite of tools. Use it to convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.The above quoted paragraph is an understatement of the abilities of convert. Besides many amazing acts, Convert is capable of creating of animated GIF images. To do so, type the following in terminal:
$ convert -delay 100 -loop 0 image*.png animation.gif
For more on ImageMagick, I recommend this blog post.
Subscribe to:
Posts (Atom)