Bmp2DHR , Apple II Graphics and Googling for Heroes

 

Original Image - Cropped and Scaled

DHGR – Default palette, Buckels Dithering

HGR – Default palette, Buckels Dithering

HGR – tohgr HGR palette, Buckels Dithering

 

This article is an overview of how modern continuous tone images acquired from the Internet are prepared for conversion (using Bmp2DHR) to native Apple II graphics files for displaying on the Apple IIe (and equivalent). I’m not going to tell you how to google for images nor am I going to tell you how to save images to your computer; you can “figure-out” those details. I am assuming that you already have an image editor or a paint program that is capable of cropping an image to a smaller size and clipping unwanted content from around its borders if necessary, and I am also assuming that you already have an image editor or a paint program that is capable of scaling separately in the horizontal and vertical axes, and that you know how to use these things.

 

What I am going to tell you is that the high quality, good contrast and even color distribution of today’s digitally produced illustrations generally result in better HGR and DHGR conversions than scanned comic books, old TV and movie screen captures, scans of old photos, and things of that nature.    

 

Nominal Resolution

 

Original Image - Cropped and Scaled

DHGR – Default palette, Buckels Dithering

HGR – Default palette, Buckels Dithering

HGR – tohgr HGR palette, Buckels Dithering

 

Bmp2DHR works on the principle of “Nominal Resolution” which is a fixed scaling window representing the Apple II display. This is to support a variety of activities and rendering and output options. While modern computers and the Internet generally provide image content in “square pixels”, legacy computers like the Apple IIGS and IBM-PC used “Classic Sizes” which did not all have square pixels. Bmp2DHR accommodates both scenarios by using the following nominal resolutions for Apple II Hi-Res Graphics (HGR) and Double Hi-Res Graphics (DHGR) Output:

 

 

All HGR and DHGR color output is internally scaled to 140 x 192 which is the nominal resolution of the Apple II HGR and DHGR color display. Monochrome DHGR output is internally vertically scaled to a nominal resolution of 560 x 192 (when needed). Monochrome HGR output is not scaled internally; nominal resolution is 280 x 192. If required, it is up to the user to clip, scale, and otherwise prepare images for conversion outside of Bmp2DHR in a paint program or graphics editor, and to export or save images to uncompressed monochrome, 16-color, 256 color, and 24-bit Windows BMP Version 3 format (without color space information). Bmp2DHR only accepts BMP files and does not accept files in jpeg, gif, png, or the many other formats out there. Windows BMP input files must be in the size ranges noted above to produce full-screen output.

 

Original Image - Cropped and Scaled

DHGR – Default palette, Buckels Dithering

HGR – Default palette, Buckels Dithering

HGR – tohgr HGR palette, Buckels Dithering

 

Square Pixels and Proportional Apple II Output

 

The Apple II display is based on an NTSC television which has a screen aspect ratio of 4:3. To remain proportional to an Apple II using a television as a display, a square-pixel full-screen image for conversion must be clipped and pre-scaled from a 4:3 screen aspect ratio rectangle to a target size matching one of Bmp2DHR’s nominal sizes for Apple II output.  A calculator will likely be needed for “figuring-out” cropping and scaling sizes unless the original image is already a 4:3 screen aspect.  560 x 384 is the most versatile nominal size to scale to for full-screen square-pixel images, since both HGR and DHGR colored and DHGR monochrome output can be produced from the same BMP input file. Image fragment output for color DHGR must also follow this same “nominal size rule”, by using the boundaries of a target nominal resolution of 280 x 192 to scale-to.

 

Original Image - Cropped and Scaled

DHGR – Default palette, Buckels Dithering

HGR – Default palette, Buckels Dithering

HGR – tohgr HGR palette, Buckels Dithering

 

Some of the following full-screen 4:3 aspect square-pixel continuous tone image sizes are fairly common on the Internet especially as high quality desktop wallpaper:

 

 

Google images works well for content searches of images, but Wikipedia also has high quality continuous tone square-pixel historic images, photos, illustrations and art reproductions available in various resolutions, many already in a 4:3 screen aspect or close to it, so cropping of these is minimal. Today’s LCD monitors do not use a screen aspect of 4:3, often using a 16:9 screen aspect and a full-screen square-pixel continuous tone image size of 1366 x 768. Bmp2DHR can’t make assumptions about whether an image came from an old or new display, so an LCD image that is not in 4:3 screen aspect must be cropped in some way, shape, or form for proportional display on the Apple II, prior to pre-scaling to one of Bmp2DHR’s nominal sizes. 

 

Cropping a Square Pixel Image 

 

Cropping comes in 3 variations:

 

Window Box – “Clipped” (“zoomed-in” and “panned”) to size

Letter Box – Wide images with top and/or bottom borders (“zoomed-out”)

Pillar Box – Tall images with left and/or right borders

 

Window-Boxed DHGR Conversion

Letter-Boxed DHGR Conversion

Pillar-Boxed DHGR Conversion

Pillar-Boxed DHGR Conversion

 

Keeping the 3 cropping variations above in mind, the calculation for an image-cropping size for the 4:3 square-pixel screen aspect-ratio is a simple formula. You will need to decide how you want your image presented, but the simplest thing to do with most images is to crop to a Window Box of 4:3 prior to scaling to a nominal size.

 

If the image is too long to fit into a 4:3 “pixel rectangle”, it is window-boxed by cropping the height to 75% of the width. Alternately it can be pillar-boxed by padding it out, rather than being cropped. The pillar-boxed pixel width is 1.333 % (1/3) greater than the scan-line height of the image. Although cropping is generally done to center the image, this too is a matter of your judgment, and will largely depend on both the composition of the image and your intended purpose for the Apple II output.

 

Cropping Image Fragments

 

Cropping of DHGR image fragments (“Sprites”) follows the same guidelines as for full-screen images. A technique that simplifies this process is to pad the square-pixel image fragment with black-space or white-space to a 4:3 image aspect, then to scale the padded image to a nominal resolution of 280 x 192, then to crop the padding before exporting to (or saving as) a BMP file for conversion. Saving an image fragment to Apple II format has the advantage (over a full-screen with padding) of saving disk space and load-memory by not storing the padding in a letter-boxed or pillar-boxed full-screen image. But it is easier to load a letter-boxed or pillar-boxed full-screen image in an Apple II program. However, since image fragments load from the top down the Apple II’s “venetian blind” effect does not occur when loading image fragments so aesthetically it may be desirable to convert to an image fragment despite the loader’s extra programming.      

 

Apple II Display Monitor Physical Sizes

 

The physical display size of an Apple II Monitor (or Television) and adjustments (if any) on the monitor (or Television), also determine if the converted image will be proportional.

 

 

The emulator screen captures above (and throughout this article) are from a square-pixel display on the Windows XP desktop; the display area is 560 pixels wide and 384 scan-lines deep, and does not accurately reflect the proportions you will see on a real Apple II display of one kind or another, including those displays that “mix and match” third-party monitors or monitors from other computers that work with the Apple II. During the era that the Apple II saw wide use, computer monitor display standards evolved from television standards, ending up where we are today with yet even more standards, but generally with “square-pixel” modern continuous tone images.

 

Wikipedia lists the Apple IIe DHGR Monochrome Standard as 35:12 (pixel to scan-line ratio), and the HGR and DHGR Color Standard as 35:48 (pixel to scan-line ratio), at a screen aspect ratio of 4:3. Rest assured that these are, in fact, exactly the ratios that are used by Bmp2DHR for nominal resolutions and internal scaling, so don’t judge the proportions of your conversions by your emulator’s square-pixel display.

 

Another Thing or Two

 

Original Image - Cropped and Scaled

DHGR – Default palette, Buckels Dithering

HGR – Default palette, Buckels Dithering

HGR – tohgr HGR palette, Buckels Dithering

 

This article isn’t really about palettes or rendering, but especially for HGR conversions you have probably noticed that color hues “hover” between the two palettes that are displayed in the examples. The DHGR conversions have 15 discrete NTSC colors so they stand a better chance of “balancing-out” but with so few colors available in HGR mode, it is somewhat more difficult to get the hues “right”. Yellow is missing from the HGR palette altogether. Despite your best efforts, sometimes even with DHGR conversions, the colors “won’t work” all that well, but generally by working with high quality content using the full color depth of modern continuous tone images and following the guidelines in this article your conversion results will be satisfactory.

 

And with several built-in conversion palettes also available, and many other rendering options to help you along with more difficult conversions, chances are good that you will enjoy more good results than merely satisfactory and bad ones.

 

 

Download Bmp2DHR

 

Original Image - Cropped and Scaled

DHGR – Default palette, Buckels Dithering

HGR – Default palette, Buckels Dithering

DHGR Mono – 25% Reduced Color Bleed

 

Download Bmp2DHR at the following links:

 

Win32 and latest version complete with source:

http://www.appleoldies.ca/cc65/programs/dhgr/bmp2dhr.zip

 

MS-DOS: http://www.appleoldies.ca/cc65/programs/dhgr/bmp2dhrMSDOS.zip

 

Other: (Linux, OSX): http://hoop-la.ca/apple2/appleoldies/bmp2dhr/

 

All the best,

 

Bill Buckels

bbuckels@mts.net

 

December 31, 2014