#!/usr/bin/env python

import sys

import numpy
from PIL import Image
from visdom import Visdom


def usage():
    print("""NAME -- imgcat-visdom

SYNOPSIS
  imgcat-visdom <imagefile> ...
    """)


if __name__ == '__main__':
    n = len(sys.argv)
    if n == 1:
        usage()
    else:
        plot = Visdom()
        for i in range(1, n):
            plot.image(numpy.array(Image.open(sys.argv[i])).transpose((2, 0, 1)))
