Add better handling of image quality settings. Make magic constants more clear.