stefanhaustein/TerminalImageViewer

Explicit size specification needed when redirecting output

nielsbasjes opened this issue · 6 comments

I would like to have the option to write the ASCII with escape codes and all to a file in such a way that at a later moment I can simply do cat file.ans and see the image.

NOTE: I tried to simply redirect the output to a file which resulted in a 0 bytes file.

Redirection should work... Perhaps something trivial is missing such as flushing the output stream...?

On which platform did you encounter this problem?

p.p.s: Did you try with an explicit size? I think a problem might be failure to detect the terminal size?

Redirecting to file works fine here. Be sure to specify a -w width and a -h larger than required.

e.g. tiv -w 80 -h 400 mypic.png > mypic.ans && cat mypic.ans

Sorry for the late reply.
Yes, the redirect with the -h and -w works like a charm.
Thanks.

Perhaps it is useful having this in the readme?
Or a helpful message to stderr in case of the 0 bytes situation?

I think we could check whether the value is reasonable if there is no explicit width, and use a default value if not