How to design a loader for different types of images?
问题 I'm working on a side project that does matrix calculations over a large number of images. To achieve this, I'm using several different libraries (including libpng, libjpg, libtiff and easybmp) to load, maybe preprocess (i.e. grayscale or resize), and store the images. Each of these libraries stores the images differently, and this is where the issue occurs. I want to use strategy to have a base class named Image and multiple derived classes (i.e. ImagePNG, ImageBMP, etc.), and factory to