Write a program that generates a fractal image of the Mandelbrot set using multithreading. The program should take as input the resolution of the image, the number of iterations to perform for each pixel, and the number of threads to use. The program should output the generated image as a PNG file.

The Mandelbrot set is a complex mathematical object that can be visualized as an intricate and beautiful fractal. Generating an image of the Mandelbrot set involves performing a large number of calculations for each pixel in the image, which can be computationally intensive. To speed up the calculation, the program should use multithreading to perform the calculations in parallel.