A terminal based netpbm image viewer
Go to file
sloum 120d0dd63e Fixes fit resizing smaller images and adds comments about broken scaling 2021-04-21 20:14:08 -07:00
examples Fixes fit resizing smaller images and adds comments about broken scaling 2021-04-21 20:14:08 -07:00
termios Adds working terminal viewer for pbm docs of type P1, P2, and P3 with available scaling 2021-04-20 22:50:56 -07:00
.gitignore Adds working terminal viewer for pbm docs of type P1, P2, and P3 with available scaling 2021-04-20 22:50:56 -07:00
LICENSE Adds simple readme and license 2021-04-20 23:01:32 -07:00
README.md Adds readme text 2021-04-20 23:05:03 -07:00
main.go Fixes fit resizing smaller images and adds comments about broken scaling 2021-04-21 20:14:08 -07:00

README.md

pbmview

pbmview is a program, written in golang, to display netpbm images in a terminal. This likely exists as a part of the very large netpbm package many operating systems/distros make available in their repositories... but it was fun to work on.

At present pbmview supports: P1, P2, and P3 images (all of the human readable ASCII file types). Support may get added at a later point for types > P3 (binary types). The ascii types are fun to use to create little icons that can be used in shell scripts or the like. The fact that they are human readable make them a cool format for sharing over gopher/gemini as plain text. This formatting, being ascii based, will result in a larger image size than a jpg/png/etc in most cases, so if you decide to use it I recommend doing so for its ease of programming/scripting and for its ease of human readability.

Build and Use

If you have a golang compiler you should be able to compile the program (likely with go build or go install) and run it as follows:

pbmview [flags] [path to pbm/pgm/ppm]

The available flags are:

  • -fit - Will shrink the image to the terminal width. If the image width is already smaller than the terminal, it will just display it.
  • -scale [chars] - Will scale the image to a width equal to chars, where chars represents a pixel width in terminal characters.
  • -h - Print help text and exit

Examples netpbm images are provided in the examples folder (which contains its own readme for attribution purposes).