|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Article Discussion: Imagine Python
Quite a cryptic title, but if you haven’t guessed, were talking about Images. This being a Python article that’s what we're using! If you’ve never thought about it, or -- even better -- if you didn’t know it was possible then you’re in for a nice surprise; not only can Python do this but it’s pretty damn good at it, too. Actually, Python works well with graphics in general, but for now we’re sticking to the 2D kind.
Read the full article here: Imagine Python |
|
#2
|
|||
|
|||
|
A good article, but some of the code formatting was lost, which of course totally buggers up Python. I would have expected DevShed to be more careful about this.
Dave - The Developers' Coach |
|
#3
|
|||
|
|||
|
size = list(image.size)
size.sort() size[0] Is just horrible. Use max(image.size) or min(image.size) for that purpose instead. They work on all sequences. As far as I can tell "image.paste" only needs upper left corner, so you don't have to calculate point3 and point4. Style matters: This is nitpicking, but in an article where newbies will learn from your coding style it might be important. I personally think that the "pass" command is more suitable than "None" in a try-except form. Pass is there for exactly that reason. "None" makes it look like the code is in functional style and that the try-except clause should evaluate to something. for each in os.listdir() looks like a foreach clause in a lesser language. When reading the code in the loop, "each" gives no hint to what it contains. It is bad coding praxis. Why not use "for filename in ..." instead (or file, name, fname or whatever)? |
![]() |
| Viewing: Dev Shed Forums > Other > Development Articles > Article Discussion: Imagine Python |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|