Trying to read the result of histogram analysis in python but running into issues based on the stdout formatting.
I run:
Code: Select all
convert pic_4.jpg -colors 256 -depth 8 -format "%c" histogram:info: | head -n 5 >> hist_4.txt
Code: Select all
705711: ( 37, 42, 35) #252A23 srgb(37,42,35)
562775: ( 39, 39, 41) #272729 srgb(39,39,41)
154348: ( 39, 42, 30) #272A1E srgb(39,42,30)
88998: ( 40, 41, 54) #282936 srgb(40,41,54)
5824: ( 40, 49,102) #283166 srgb(40,49,102)
Code: Select all
df = pd.read_table(filename, sep='\s+', header=None)
Ideally I would like to format the stdout to use comma or tab separated values. OR just strip out the formatting and not add leading spaces in the case of a 1 or 2 digit value.
I've tried searching but only get results showing how to format image outputs, not histogram text stdout.
Thanks in advance!
-Sante