Fractal encoding of digital images with an optimization algorithm