python-imgcat icon indicating copy to clipboard operation
python-imgcat copied to clipboard

[suggest] add a option to output original size

Open selaselah opened this issue 6 years ago • 3 comments

img = np.random.randint(0, 255,  [512,512], np.uint8)
imgcat(img) # the output image will auto resized to (372, 372)

selaselah avatar Apr 24 '19 06:04 selaselah

Can you please elaborate on this? Currently we take the image shape into consideration to determine the height to display image with.

wookayin avatar May 02 '19 02:05 wookayin

the behavior of this package is different with original imgcat. imgcat of iterm version will display image with orignal size. while this package display image with recomputed size.

the programming interface

def imgcat(data, filename=None,
           width=None, height=None, preserve_aspect_ratio=True,
           pixels_per_line=24,
           fp=None)

It is hard to output original size if some one want to output original size, he must spec pixels_per_line with a 'right' value.

the cmd interface

usage: imgcat [-h] [--height HEIGHT] [--width WIDTH] [-v] [input [input ...]]

imgcat in Python.

positional arguments:
  input            Path to the images.

optional arguments:
  -h, --help       show this help message and exit
  --height HEIGHT  The number of rows (in terminal) for displaying images.
  --width WIDTH    The number of columns (in terminal) for displaying images.
  -v, --version    show program's version number and exit

is even harder. He must get image size in pixel and div with 24.

selaselah avatar May 09 '19 10:05 selaselah