https://github.com/markmll/ppmtomask
Generate a mask from a .ppm file based on pixel saturation or colour.
https://github.com/markmll/ppmtomask
Last synced: 4 months ago
JSON representation
Generate a mask from a .ppm file based on pixel saturation or colour.
- Host: GitHub
- URL: https://github.com/markmll/ppmtomask
- Owner: MarkMLl
- License: mit
- Created: 2022-11-26T07:59:55.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-26T08:05:44.000Z (over 3 years ago)
- Last Synced: 2025-10-10T23:34:19.547Z (8 months ago)
- Language: Pascal
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ppmtomask
Generate a mask from a .ppm file based on pixel saturation or colour.
Read a .ppm file (P3 or P6) as named by the final parameter of the command line, and generate a mask based either on the degree of pixel saturation or on a pixel being a specific colour.
If the first parameter on the command line is -saturation then the second is assumed to be a percentage, pixels with more than this saturation (e.g. pure red or blue as distinct from medium-saturation purple) are output black with everything else white.
If the first parameter on the command line is -colour then the second etc. are assumed to be RGB triplets each expressed as six hex digits, pixels with any precisely-matched colour are output black with everything else white.
The intention of this program is to generate masks to allow coloured lines or areas that have been overlaid onto a photograph to be extracted and reused. As a specific example, a synoptic weather chart might have its front lines removed, a rainfall radar image overlaid, and the fronts replaced as the top layer.