Refactored common fractal rendering code into createFractalImage function.