I am no expert on Windows (use Mac OSX brand Unix mostly).
The quote was a standard single quote, but I think you can also use double quotes also. It is not a slant quote.
Windows has some issues with needing different escapes and other things. So you might be best looking at
http://www.imagemagick.org/Usage/api/#windows
I think the following are your two problems per the error messages:
1) You don't want a colon after bmp in your filename? The colon is used only for IM special images such as rose:
(see
http://www.imagemagick.org/script/forma ... tin-images)
2) Also you need to use -colors not -colours! (US English not British/Australian/Canadian English)
Hope this helps.
P.S. If you don't want to use sed, you can also do it like this:
imagefile="rose.jpg"
topname=$(convert "$imagefile" -format "%t" info:)
echo "$imagefile Histogram:" > ${topname}_hist.txt
convert "$imagefile" -colors 256 -depth 8 -format "%c" histogram:info: | head -n 10 >> ${topname}_hist.txt
Note:
topname=$(convert "$imagefile" -format "%t" info:)
can also be written as
topname=`convert "$imagefile" -format "%t" info:`
using slant quotes
Result will be rose_hist.txt
rose.jpg Histogram:
48: (105, 99, 83) #696353 rgb(105,99,83)
48: (248,250,247) #F8FAF7 rgb(248,250,247)
43: ( 44, 43, 42) #2C2B2A rgb(44,43,42)
39: (216, 69, 60) #D8453C rgb(216,69,60)
34: ( 55, 44, 39) #372C27 rgb(55,44,39)
34: ( 57, 70, 55) #394637 rgb(57,70,55)
32: ( 40, 54, 40) #283628 rgb(40,54,40)
32: (119, 56, 42) #77382A rgb(119,56,42)
31: (106,146, 74) #6A924A rgb(106,146,74)
29: ( 54, 44, 51) #362C33 rgb(54,44,51)
Note indents of histogram lines will not show above, but will be in the file
Or you can do:
imagefile="rose.jpg"
topname=$(convert "$imagefile" -format "%t" info:)
echo "$imagefile" > ${topname}_hist.txt
echo "Histogram:" >> ${topname}_hist.txt
convert "$imagefile" -colors 256 -depth 8 -format "%c" histogram:info: | head -n 10 >> ${topname}_hist.txt
results will be:
rose.jpg
Histogram:
48: (105, 99, 83) #696353 rgb(105,99,83)
48: (248,250,247) #F8FAF7 rgb(248,250,247)
43: ( 44, 43, 42) #2C2B2A rgb(44,43,42)
39: (216, 69, 60) #D8453C rgb(216,69,60)
34: ( 55, 44, 39) #372C27 rgb(55,44,39)
34: ( 57, 70, 55) #394637 rgb(57,70,55)
32: ( 40, 54, 40) #283628 rgb(40,54,40)
32: (119, 56, 42) #77382A rgb(119,56,42)
31: (106,146, 74) #6A924A rgb(106,146,74)
29: ( 54, 44, 51) #362C33 rgb(54,44,51)
where %t is the top of the filename (suffix removed)
see
http://www.imagemagick.org/script/escape.php
This puts it all in one long (awkward?) command:
echo "rose.jpg"$'\n'"Histogram"$'\n'"`convert rose.jpg -colors 256 -depth 8 -format "%c" histogram:info:`" | head -n 12