Some people reported high CPU/RAM usage with the ThumbnailGenerator script, so I made some modifications to it:
1. ImageMagick was leaving around some temporary files after it ran, so now I clean up the TEMP_DIR location after the thumbnail attribute is set. this should prevent the temp directory from filling up.
2. I explicitly call gc.collect() after each call to generateThumbnail(). The thumbnail and hex versions get manipulated in memory in generateThumbnail() and I was relying on garbage collection to clean things up when the variables go out of scope, but gc.collect() is supposed to make it a little more explicit and help with performance, so I figured I could give it a try.
3. Experimenting on my VM, I ran the script and it gobbled up CPU (~70%) when running. I found that setting the nice level made it much less CPU-intense. For example: