Boost logo

Boost Users :

Subject: Re: [Boost-users] [GIL] Inspecting any_image
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-12-27 04:34:22


Hi Szymon,

On Sun, Dec 26, 2010 at 8:39 PM, Szymon Gatner <szymon.gatner_at_[hidden]> wrote:
> Is it possible to find out which of allowed image formats any_image
> actually has?
>
> For example, if image is loaded with code provided in dynamic_image.cpp:
>
>    typedef boost::mpl::vector<gray8_image_t, rgb8_image_t,
> gray16_image_t, rgb16_image_t> my_images_t;
>
>    any_image<my_images_t> dynamic_img;
>    jpeg_read_image("test.jpg",dynamic_img);
>
> how to figure out which colorspace / layout loaded image have?
>

An any_image is derived from gil::variant which lets you get the index
from the type vector you specified. There also is a member called
"current_type_is()". But normally you don't need to cast an any_image
to a specific type since it should behave like a normal image or view.

Let me know if you have more questions.

Regards,
Christian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net