Replace each horizontal pixal in an image with an RGB sub-pixel. Reduces the width of an image to one third of its original width. Converts an image to grayscale before scaling.
Aspect ratio can be maintained using the -a
flag, but it reduces the images height to 1/3 its original height when converting to subpixel to match the new width, and stretches the image's height 3x when converting back to full size grayscale or expanded pixel format.
I thought it would be interesting.
Inspired by https://www.youtube.com/watch?v=SlS3FOmKUbE
Usage of subpixel:
-a maintain aspect ratio when converting, makes the image 1/3 as tall when shrinking and 3x taller when reversing
-e expand each pixel to three full color pixels
-i string
input png
-o string
output png
-r reverse process
go build
subpixel -i smiley.png -o smiley-subpixel.png
subpixel -r -i smiley-subpixel.png -o smiley-restored.png
subpixel -e -i smiley-subpixel.png -o smiley-expanded.png