Re: RGB colorspace question

Michael Orlitzky <[email protected]> Tue, 9 Jan 2024 18:03:37 -0500
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <ZZ3Qyc9BWkDi0Y9q@stitch>
On 2024-01-09 11:30:08, Bob Friesenhahn wrote:
> 
> The use of a "TXT" extension is obviously a very poor choice of file 
> extension given that it can mean entirely different things.
> 

And that concludes this demonstration of the XY problem.

Can I ask a different question? The code that is calling "convert" is
using it from within GAP, an algebra suite. As a result, it doesn't
have a lot of native image processing capabilites -- what it does
have is a way to call shell commands.

The goal is to take an arbitrary image and convert it to a matrix of
numbers, whose (x,y)th entry is the sum of R+G+B for the (x,y)th pixel
in the image. Afterwards, some other processing happens to turn the
matrix back into a GAP object whose meaning is beyond my
comprehension. In any case, it's using "convert ... foo.txt" as a
shortcut to obtain the (linear) RGB values at each pixel, because
afterwards it's relatively easy to parse the integers out of the text
file.

Is there some other way to get the linear RGB pixel values, that would
work the same in both GM and IM? Perl and anything POSIX should also
be fair game. I think the difficulty lies in figuring out the color
space of the source.