diff --git a/full-color/out/lion-FINAL-APPX.png b/full-color/out/lion-FINAL-APPX.png new file mode 100644 index 0000000..7772c13 Binary files /dev/null and b/full-color/out/lion-FINAL-APPX.png differ diff --git a/full-color/out/painting-swirl-FINAL-APPX.png b/full-color/out/painting-swirl-FINAL-APPX.png new file mode 100644 index 0000000..1daa70d Binary files /dev/null and b/full-color/out/painting-swirl-FINAL-APPX.png differ diff --git a/full-color/out/pink-cosmos-FINAL-APPX.png b/full-color/out/pink-cosmos-FINAL-APPX.png new file mode 100644 index 0000000..f4e6f32 Binary files /dev/null and b/full-color/out/pink-cosmos-FINAL-APPX.png differ diff --git a/full-color/out/radiant-color-FINAL-APPX.png b/full-color/out/radiant-color-FINAL-APPX.png new file mode 100644 index 0000000..a76c4a7 Binary files /dev/null and b/full-color/out/radiant-color-FINAL-APPX.png differ diff --git a/full-color/readme.md b/full-color/readme.md new file mode 100644 index 0000000..c53fd5d --- /dev/null +++ b/full-color/readme.md @@ -0,0 +1,40 @@ +# Full-color + +This is based off of a concept seen on early systems to simulate separate Red, Green, and Blue scanlines in order to approximate a higher number of colors. + +## About +In this case we are targeting the 12-bit color space on the Apple IIgs (2^12 = 4096). It color system allows 4-bits per channel, meaning I can have a red value from 0-15, a green value from 0-15, and a blue value from 0-15. In hexadecimal it looks like this #$06FA, with the leftmost zero nibble being ignored on the IIgs. + +To approximate it here, we use imagemagick to perform the following conversion steps: + +- resize the image to 320x67 - because IIgs resolution is 320x200 and we want it 1/3 height so CEILING(66.66666) +- crop it into 67 images - each sized 320x1 - still all full color +- for each line: + - remove two channels (Green,Blue) to get remaining channel (Red) + - reduce that channel to a 16 color, 12 bit, dithered image + - recombine the 67 * 3 images into single 320x201 image + - crop to 320x200, effectively dropping the last Blue line since we start with RGB at the top + +## Prerequisite +You must have imagemagick installed. To see if it's installed, open a command line and type `convert` + +If you need to install it, for Mac OSX, I'd suggest `brew`: +```$ brew install imagemagick``` + +Linux - RHEL/CentOS +```$ sudo yum install ImageMagick``` + +Linux - Debian/Ubuntu +```$ sudo apt-get install imagemagick``` + +## Running the script to build an image +Basically you can just run the `slicer.sh` script against any image that imagemagick supports. + +```./slicer.sh my_picture.png``` + +## Running the test suite + +From the parent directory (the one this readme file is in), run the test script: +```$ ./tests/run_1.sh``` + +Output will be generated in the **out/** directory. diff --git a/full-color/scripts/slicer.sh b/full-color/scripts/slicer.sh new file mode 100755 index 0000000..4e13a6c --- /dev/null +++ b/full-color/scripts/slicer.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +IMAGE=$1 # ./something/foo.png +IMAGEBASE=$(basename $IMAGE) # foo.png +IMAGEBASENOEXT=${IMAGEBASE%%.*} # foo +OUTBASE=out +OUTDIR=$OUTBASE/$IMAGEBASENOEXT + + +mkdir -p $OUTDIR + +# start with RGB, so from 200 vertical pixels divided by 3 colors = 320x66.6 (we'll do 67 and remove extras) +# also, we don't reduce colors yet, because we need 67 full-color lines to split into three separate +# 4-bpc (12bit color) lines to composite at the end +convert -resize 320x67\! -crop 320x1 $IMAGE $OUTDIR/$IMAGEBASENOEXT-%03d.full.png + +for file in `ls $OUTDIR/$IMAGEBASENOEXT*.full.png`; +do + echo Working on splice: $file + filebase=$(basename $file) + filebasenoext=${filebase%%.*} + dither=Riemersma + convert -channel Green,Blue -evaluate set 0 +channel -colors 16 -depth 12 -dither $dither $file $OUTDIR/$filebasenoext.gs.0-R.png + convert -channel Red,Blue -evaluate set 0 +channel -colors 16 -depth 12 -dither $dither $file $OUTDIR/$filebasenoext.gs.1-G.png + convert -channel Red,Green -evaluate set 0 +channel -colors 16 -depth 12 -dither $dither $file $OUTDIR/$filebasenoext.gs.2-B.png +done + +convert -append $OUTDIR/$IMAGEBASENOEXT*gs* $OUTDIR/$IMAGEBASENOEXT-FINAL.png +convert -crop 320x200 $OUTDIR/$IMAGEBASENOEXT-FINAL.png $OUTBASE/$IMAGEBASENOEXT-FINAL-APPX.png diff --git a/full-color/tests/run_1.sh b/full-color/tests/run_1.sh new file mode 100755 index 0000000..9adbe95 --- /dev/null +++ b/full-color/tests/run_1.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# run from parent dir "./tests/run_1.sh" +for i in lion.jpg painting-swirl.jpg pink-cosmos.jpg radiant-color.jpg ; +do + ./scripts/slicer.sh ../sample_images/$i +done diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..75a4cd3 --- /dev/null +++ b/readme.md @@ -0,0 +1,4 @@ +# Image Conversion Tools for the Apple IIgs +This is a set of random utilities and convertors I've written over the years. Each on is it's own directory here with a readme, so you'll have to click on the directories to see what a tool does. + +Currently I've only added a recently written tool, `full-color`. I'll try to add others as I start scouring my archives and clean them up. diff --git a/sample_images/lion.jpg b/sample_images/lion.jpg new file mode 100644 index 0000000..9b15597 Binary files /dev/null and b/sample_images/lion.jpg differ diff --git a/sample_images/painting-swirl.jpg b/sample_images/painting-swirl.jpg new file mode 100644 index 0000000..264d061 Binary files /dev/null and b/sample_images/painting-swirl.jpg differ diff --git a/sample_images/pink-cosmos.jpg b/sample_images/pink-cosmos.jpg new file mode 100644 index 0000000..a831f66 Binary files /dev/null and b/sample_images/pink-cosmos.jpg differ diff --git a/sample_images/radiant-color.jpg b/sample_images/radiant-color.jpg new file mode 100644 index 0000000..5ff3cd1 Binary files /dev/null and b/sample_images/radiant-color.jpg differ