    const unsigned char *_bool2uchar(ulongT &siz, const bool is_multiplexed) const {
      const ulongT _siz = size();
      siz = _siz/8 + (_siz%8?1:0);
      unsigned char *const buf = new unsigned char[siz], *ptrd = buf, val = 0, bit = 0;

      if (!is_multiplexed || _spectrum==1) // Non-multiplexed
        cimg_for(*this,ptrs,T) { (val<<=1)|=(*ptrs?1:0); if (++bit==8) { *(ptrd++) = val; val = bit = 0; }}
      else // Multiplexed
        cimg_forXYZ(*this,x,y,z) cimg_forC(*this,c) {
          (val<<=1)|=((*this)(x,y,z,c)?1:0); if (++bit==8) { *(ptrd++) = val; val = bit = 0; }
        }
      if (bit) *ptrd = val;
      return buf;
    }
    const unsigned char *_bool2uchar(ulongT &siz, const bool is_multiplexed) const {
      const ulongT _siz = size();
      siz = _siz/8 + (_siz%8?1:0);
      unsigned char *const buf = new unsigned char[siz], *ptrd = buf, val = 0, bit = 0;

      if (!is_multiplexed || _spectrum==1)  
        cimg_for(*this,ptrs,T) { (val<<=1)|=(*ptrs?1:0); if (++bit==8) { *(ptrd++) = val; val = bit = 0; }}
      else  
        cimg_forXYZ(*this,x,y,z) cimg_forC(*this,c) {
          (val<<=1)|=((*this)(x,y,z,c)?1:0); if (++bit==8) { *(ptrd++) = val; val = bit = 0; }
        }
      if (bit) *ptrd = val;
      return buf;
    }