Page 1 of 1

Writing and Reading TXT images problems

Posted: 2019-03-19T02:38:36-07:00
by ddosimg
Hi guys and gals.
I was a bit confused when I finished the code below.

command 1:
convert -size 2x1 xc:none \
-fill 'rgb(0,0,0)' -draw 'point 0,0' \
-fill 'rgb(0,0,1)' -draw 'point 1,0' \
-colorspace rgb -depth 8 \
out.png

command 2:
convert out.png -colorspace rgb -depth 8 out.txt

actual output:
```
# ImageMagick pixel enumeration: 2,1,255,rgb
0,0: (0,0,0) #000000 rgb(0,0,0)
1,0: (0,0,0) #000000 rgb(0,0,0)

```

expected:
```
# ImageMagick pixel enumeration: 2,1,255,rgb
0,0: (0,0,0) #000000 rgb(0,0,0)
1,0: (0,0,1) #000000 rgb(0,0,1)

```

Why the outputs is not exact my expected?
Can any one help me ?
Thanks!

Ubuntu 16.04
Version: ImageMagick 6.8.9-9 Q16 x86_64 2018-09-28 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib

Re: Writing and Reading TXT images problems

Posted: 2019-03-19T04:10:43-07:00
by snibgo
What version IM, on what platform?

For the past few years, when IM creates an images, it encodes the image as non-linear sRGB. You then convert your image to linear RGB with "-colorspace RGB". This converts the very low value 1/255 to become 0/255.

Re: Writing and Reading TXT images problems

Posted: 2019-03-19T06:00:52-07:00
by ddosimg
Awesome!!!
Thanks for your help.
And sorry for my carelessness, I have added the version information.

Re: Writing and Reading TXT images problems

Posted: 2019-03-19T06:01:56-07:00
by ddosimg
snibgo wrote: 2019-03-19T04:10:43-07:00 What version IM, on what platform?

For the past few years, when IM creates an images, it encodes the image as non-linear sRGB. You then convert your image to linear RGB with "-colorspace RGB". This converts the very low value 1/255 to become 0/255.
Awesome!!!
Thanks for your help.
And sorry for my carelessness, I have added the version information.