Page 1 of 1

How would I create a 1x3 png with three rgb pixels?

Posted: 2016-11-09T15:11:44-07:00
by patrick99e99
with the convert utility, how can I create a png image that is:

* 1px in height
* 3px in width
* pixel[0] is red
* pixel[1] is green
* pixel[2] is blue

?

Re: How would I create a 1x3 png with three rgb pixels?

Posted: 2016-11-09T15:26:56-07:00
by GeeMack
patrick99e99 wrote:with the convert utility, how can I create a png image that is [...]

Code: Select all

convert xc:#FF0000[1x1] xc:#00FF00[1x1] xc:#0000FF[1x1] +append rgb.png

Re: How would I create a 1x3 png with three rgb pixels?

Posted: 2016-11-09T15:38:48-07:00
by patrick99e99
Thank you!

Re: How would I create a 1x3 png with three rgb pixels?

Posted: 2016-11-09T15:57:23-07:00
by fmw42
This is sufficient:

Code: Select all

convert xc:#FF0000 xc:#00FF00 xc:#0000FF +append rgb.png
IM assumes 1x1 pixel if not specified by -size

Re: How would I create a 1x3 png with three rgb pixels?

Posted: 2016-11-09T23:38:33-07:00
by snibgo
Just to be even more minimalist, colours can be specified by only three hex digits. IM replicated the digits as required.

Code: Select all

convert xc:#F00 xc:#0F0 xc:#00F +append rgb.png

Re: How would I create a 1x3 png with three rgb pixels?

Posted: 2016-11-10T14:53:45-07:00
by glennrp
This is fine for Windows but on *nix the "#" will comment out the remainder of the line.

Code: Select all

magick xc:#F00 xc:#0F0 xc:#00F +append rgb.png
So, on *nix, use one of these:

Code: Select all

magick xc\#F00 xc:\#0F0 xc:\#00F +append rgb.png
magick xc:"#F00" xc:"#0F0" xc:"#00F" +append rgb.png
magick xc:red xc:lime xc:blue +append rgb.png