In OS X, Automator lets you add Finder context menu options that can, among other things, trigger AppleScript actions that can, in turn, run arbitrary (command-line and GUI) programs. These actions can optionally be configured to only appear for certain file types.
Recent Finder versions relegate custom actions to a "Quick Actions" submenu by default, but you can restore an action to top-level by removing the "NSIconName" entry from the action's Info.plist in ~/Library/Services.