The fly in the ointment – changing requirements

Of course, nothing is ever really finished. Let's pretend that you wrote the Charter library and have been busily extending it for several months, adding more data series types and lots of options. The library is being used in several big projects for your company, the output looks fantastic, and everyone seems to be very happy with it—until the day that your boss comes in and says, "It's too fuzzy. Can you take the fuzziness away?"

You ask what he means, and he says that he's been printing the charts out on a high-resolution laser printer. The results aren't good enough for him to use in his company reports. He takes a printout and points to the heading. Looking closely, you can see what he means:

The fly in the ointment – changing requirements

Sure enough, the text is pixelated, and even the lines look a bit jagged when printed at high resolution. You try increasing the size of the generated chart, but it still doesn't look good enough—and when you try increasing the size to match the 1,200 dots per inch of the company's high-resolution laser printer, your program crashes.

"But the program was never designed for that," you complain. "We wrote it to show charts on-screen."

"I don't care," says your boss. "I want you to generate the output in vector format. That always prints fine, and isn't fuzzy at all."

Note

Just in case you haven't encountered this before, there are two fundamentally different ways of storing image data: bitmapped images, which are made up of pixels, and vector images, where the individual drawing instructions (for example, "write some text", "draw a line," "fill a rectangle," and so on) are saved, and then these instructions are followed each time the image is to be displayed. Bitmapped images suffer from pixelation or "fuzziness," while vector images look great even when enlarged or printed at a high resolution.

You do a quick Google search, and confirm that the Pillow library can't save vector-format images; it only works with bitmapped data. Your boss isn't sympathetic, "Just make it work in vector format, saving to PDF as well as PNG for those people already using it."

With a sinking heart, you wonder how you could possibly meet these new requirements. The whole Charter library has been built from the ground up to generate bitmapped PNG images. Won't you have to rewrite the whole thing from scratch?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.90.182