Auto-detect optimal image output format, How to
Posted: 2010-02-16T14:49:07-07:00
I am using ImageMagick on a website to process images of scanned books. Text-only pages look the best as GIF/PNG; and mostly-image-filled pages look the best as JPEG. I'd like to find the optimal output format on the fly.
Any recommendations on how to approach this? I would imagine I need to look at the separation of colors to see how badly I need gradients (which JPEG would be ideal for). I'm looking to maximize quality and minimize file size, since they are being served on the web. The easiest solution would be really high quality JPEGs, but I'd really like to optimize the viewing experience.
Possible cases:
1) A full-page color graphic
2) Grayscale text on a FFF background
3) Text on a brown-ish background (likely several shades of brown)
4) Half text, half grayscale graphics
and so on and so on...
Any recommendations on how to approach this? I would imagine I need to look at the separation of colors to see how badly I need gradients (which JPEG would be ideal for). I'm looking to maximize quality and minimize file size, since they are being served on the web. The easiest solution would be really high quality JPEGs, but I'd really like to optimize the viewing experience.
Possible cases:
1) A full-page color graphic
2) Grayscale text on a FFF background
3) Text on a brown-ish background (likely several shades of brown)
4) Half text, half grayscale graphics
and so on and so on...