Page 1 of 1

Decode PNG into raw RGB data

Posted: 2019-05-02T09:26:38-07:00
by i73
Long story short I need to decode to raw RGB in order to encode to Av1 then decode it back to a workable file (testing new tech) and I just need to know if this is the correct way to decode a png to raw RGB:

Code: Select all

convert -size "3x3" -depth 8 encodeTest.png -colorspace RGB encodeTest.rgb

Re: Decode PNG into raw RGB data

Posted: 2019-05-02T09:42:55-07:00
by snibgo
Yes, but -size "3x3" does nothing.

Re: Decode PNG into raw RGB data

Posted: 2019-05-02T11:01:40-07:00
by fmw42
You need to know the size only when reading the raw RGB file. You will also need to know the depth when reading it. See https://imagemagick.org/Usage/formats/#rgb

Re: Decode PNG into raw RGB data

Posted: 2019-05-02T12:33:10-07:00
by i73
fmw42 wrote: 2019-05-02T11:01:40-07:00 You need to know the size only when reading the raw RGB file. You will also need to know the depth when reading it. See https://imagemagick.org/Usage/formats/#rgb
I've added

Code: Select all

-depth 8
to my code, did you miss that or am I doing it wrong?

Re: Decode PNG into raw RGB data

Posted: 2019-05-02T13:33:54-07:00
by fmw42

Code: Select all

convert encodeTest.png -colorspace RGB -depth 8 encodeTest.rgb

Re: Decode PNG into raw RGB data

Posted: 2019-05-02T14:36:42-07:00
by snibgo
Perhaps I should add that "-colorspace RGB" will convert (presumably from non-linear sRGB) to linear RGB. That's fine, if that's what you want, but it may not be.