Re: Fetch and store color value in a variable

Fred Weinhaus <[email protected]>
Newsgroups gmane.comp.video.image-magick.user
Message-ID <p06240802c720a9a74149@[192.168.1.2]>
Use txt: output to get the hex values. For example, using the IM 
internal image rose:, you can get the following.

convert rose:[1x1+0+0] txt:
# ImageMagick pixel enumeration: 1,1,255,rgb
0,0: ( 48, 47, 45)  #302F2D  rgb(48,47,45)

Now just extract the hex value.

In Unix, (I don't know Windows batch commands), I would use sed as follows:

convert rose:[1x1+0+0] txt: | tail -n 1 | sed -n 
's/^.*[\#]\([\0-9A-Fa-f]*\).*$/\#\1/p'
#302F2D
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.