Image histogram with Imagemagick

Imagemagick can show a histogram from the command line. Do this with Python for programmatic use.

magick input.jpg histogram:miff:- | magick display miff:-
input.jpg
image in ANY format to display the histogram