That command will work on the Terminal command-line, or in an Automator solution as offered below. The only thing you can do to an image in the Finder is to assign a custom color tag to it such as "RGB", "CMYK", etc in the Finder Preferences. Then in Spotlight, you can search tag:CMYK, or if in Germany, kMDItemFSLabel:CMYK .
You can make an Automator Service that allows you to select the image files in the Finder. You then press a unique assigned keyboard shortcut to the Service item, and the result would be a pop-up dialog:

The output facilities in AppleScript are quite limited, so longer filenames will not scroll, but do wrap, messing up the display.
- Launch Automator. Dock : Launchpad : Other : Automator
Choose Service, and then click Choose
- Drag and Drop the Run AppleScript action onto the larger workflow window
- Sierra and High Sierra
Automator Library
- Earlier OS X
Utilities Library
- Service receives selected Image files in Finder. Output replaces selected text remains unchecked.
- In the Run AppleScript action, you will replace the line (* Your script goes here *) with the copy/pasted AppleScript in the Code below.
- Click the compile button in the action
- File menu save and name it Image Color Space, with no file extension. You can always open this as a Recent Item in Automator if you need to change something.
- Quit Automator.
- In System Preferences : Keyboard panel : Shortcuts : Services, find your service name, and on the right side of the name click to add your unique keyboard shortcut. Be careful not to use any that are already in use by Finder.
- Quit System Preferences.
- Select a file or files in the Finder, and then apply your special keystroke. You should see the above dialog with your file information.
Code (copy/paste below this line)
use scripting additions
on run {input, parameters}
tell application "Finder"
launch
if (count of input) > 0 then
set sel to input as alias list
else
return
end if
set report to {}
repeat with afile in sel
set imgfile to afile'sPOSIX path
set cspace to (do shell script "sips -g space " & imgfile & " | awk '/space/ {print $2=$2}'") as text
if cspace is "RGB" then
set spacing to " "
else if cspace is "Gray" then
set spacing to " "
else if cspace is "CMYK" then
set spacing to " "
end if
copy (cspace & spacing & (name of afile)) as text to the end of report
end repeat
end tell
-- show a list of color space and associated filenames
set {TID, AppleScript'stext item delimiters} to {AppleScript'stext item delimiters, return}
display dialog (items of report) as text with title "Image Colorspace Report"
set AppleScript'stext item delimiters to TID
return input
end run