The image may be quantized down to eight bits but you're still working with ImageMagick's internal format. The depth of the internal format is in Magick::QuantumDepth
:
QuantumDepth
The number of bits in a quantum.
and AFAIK that's a compile-time constant for the underlying ImageMagick libraries. A QuantumDepth of 16 corresponds to a Magick::QuantumRange
of 65535 (or 0 ... 2**16
or 0 .. (2**16 - 1)
if you prefer). A quick look at Magick::Pixel
might be a good starting point for tracing all this stuff out.
If you want your values to be inside the [0, 1]
interval then scale them down using Magick::QuantumRange
:
p.channel_mean(Magick::GrayChannel).map { |x| x / Magick::QuantumRange }