|
Boost : |
From: John Femiani (JOHN.FEMIANI_at_[hidden])
Date: 2008-04-30 00:41:25
> > For hypothetical example, if the file would optimally
> choose a gray16
> > planar image, but I pass any_image<mpl::vector<rgb8_image_t,
> > gray8_image_t> > to read_image, then I want the read_image
> function
> > to create a gray8_image_t and convert the pixels to that.
> >
> > I dont know how it would be done, but that would be a nice feature.
>
> Yeah, sounds like a nice feature. I will make a mark in my todo list.
> Before I could tackle that I would need to overcome my
> template instantiation issue. I cannot even compile with MSVC
> 7.1. It's
> complaining:
>
> fatal error C1055: compiler limit : out of keys
>
> I think I need to seriously rethink the design.
Hmmm...
> >
> > I think the other thing would be for each image format to have its
> > own image_types typedef, to that I can read into an image variant
> > that is perfect for the reader.
> >
>
> Not sure if I follow here.
>
any_supported_image<jpeg_tag> result;
read_image(fname, result, jpeg_tag())
gil::apply_operation(result, my_operation)
On another note, I dont think you need filesystem to check the extension
of the images. You can use the boost string algorithms library (or just
use std::string operations).
bool can_read(std::string filename, jpeg_tag const& ){
static const string extensions[] = {".jpg", ".jpeg" };
return ::boost::algorithm::iends_with(filename, extensions[0])
|| ::boost::algorithm::iends_with(filename, extensions[1]);
}
Also, I beleive some of the image formats can peek at the first few
bytes of the file to determine if the format is appropriate. I dont know
about non-windows systems, but on some of them this might be the only
way to tell. If that is the way image formats are checked, then I dont
think filesystem (or string algs) is going to be important.
-- John
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk