Skip to content

Joe Del Rocco

Educator. Engineer. Experimenter.

Menu
  • About
  • Blog
  • CV / Resume
    • Summary
    • Teaching
    • Publications
  • Interests
    • Reading
    • Music
    • Sites / Casts
  • Contact
Menu

Scripts For .pgm Files

Posted on January 26, 2017July 19, 2021 by Joe Del Rocco

Created some scripts to help with processing .pgm files, which are simple intensity grayscale files, often the output of a special sensor, such as an IR camera. The scripts can be found here: https://github.com/delrocco/pgmhelper

original/cups.pgm scaled/cups.pgm visible/cups.png colored/cups.png
processpgm.sh wraps the scripts below for a .pgm -> color image conversion
pgmhelper.py various functionality for working with .pgm files
visualize.sh invokes ImageMagick to convert and scale .pgm images
colorize.sh invokes ImageMagick with CLUT to color an image

Process all .pgms in the specified folder:

processpgm.sh ~/images/ png 800x600

List minimum and maximum intensity values of a folder of .pgm files:

pgmhelper.py ~/images/ -r
73-1815

Find “bad” .pgm files; files with intensity values outside range [1-65536]:

pgmhelper.py ~/images/ -b
pgmhelper.py ~/images/ -b | xargs rm

Visualize .pgm files (requires ImageMagick):

visualize.sh ~/images/ ~/visible/ jpg 1024x768

False-color grayscale files with CLUT (requires ImageMagick):

colorize.sh ~/visible/ ~/colored/

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Follow

Subscribe to blog RSS feed View my profile on LinkedIn Visit our Cacti Council! View my profile on GitHub View my profile on Stackoverflow View my Sketchfab models View my ORCID

Tags

books computer science education engineering fish food fun game holiday music nature parks programming remodeling sailing science Star Trek stem travel volunteering
© 2023 Joe Del Rocco | Powered by Minimalist Blog WordPress Theme