File:Amiga HAM8 demo image.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(2,560 × 1,920 pixels, file size: 99 KB, MIME type: image/png)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: Demo image for the Commodore Amiga 320x200 HAM8 graphics mode, based on File:White-fronted bee-eater (Merops bullockoides) Namibia.jpg. (The bird's colors are more vivid here than in the source image because the source is in Adobe RGB color space.)


The source image was cropped to a 4:3 aspect ratio, scaled to 320x200, saved as PNG in Gimp, and sharpened with ImageMagick (convert -sharpen "0x0.5"). The PNG was converted to a 24-bit IFF-ILBM with the Python script below and then loaded into DeluxePaint V on the Amiga (in NTSC mode), where it was converted to a HAM8 IFF-ILBM file. Finally the image was converted back to PNG with ImageMagick, loaded in Gimp, and upscaled 8x with the aspect ratio corrected so the end result is a 4:3 image again.
Date
Source Own work
Author Morn

Python code for initial conversion to 24-bit IFF-ILBM[edit]

# Convert a PNG file to 24-bit IFF-ILBM

import pygame

img = pygame.image.load("320px.png")

# image width and height
W, H = img.get_size()

def bit16(i):
    return [i // 256, i % 256]

w1, w2 = bit16(W)
h1, h2 = bit16(H)

def bit32(i):
    h = "%08x" % i
    w = [h[k:k+2] for k in (0,2,4,6)]
    return [int(q, 16) for q in w]

form = [
 70,   # F
 79,   # O
 82,   # R
 77,   # M
]

ilbm = [
 73,   # I
 76,   # L
 66,   # B
 77,   # M
 66,   # B
 77,   # M
 72,   # H
 68,   # D
  0,   #   s
  0,   #   i
  0,   #   z
 20,   #   e
 w1,   # wid 1
 w2,   # wid 2
 h1,   # hei 1
 h2,   # hei 2
  0,   #  xor 1
  0,   #  xor 2
  0,   #  yor 1
  0,   #  yor 2
 24,   # planes
  0,   # mask 
  0,   # compression
  0,   # pad
  0,   #  trans1
  0,   #  trans2
 10,   # x aspect
 11,   # y aspect
 w1,   #  x wid1
 w2,   #  x wid2
 h1,   #  y hei1
 h2,   #  y hei2
 66,   # B
 79,   # O
 68,   # D
 89,   # Y
]


p = []


def bit_at(x, y, col, b):
    c = img.get_at((x, y))[col]
    c = ( c >> b ) & 1
    return c

for y in range(H):
    for col in 0, 1, 2:
        for b in range(8):
            line = []
            for x in range(W):
                line.append(bit_at(x, y, col, b))
            for n in range(0, W, 8):
                bb = "".join([str(q) for q in line[n:n+8]])
                p.append(int(bb, 2))

out = ilbm + bit32(len(p)) + p

out = form + bit32(len(out)) + out

out = bytearray(out)

g = open("i24.iff", "wb")

g.write(out)

g.close()

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current16:48, 20 August 2022Thumbnail for version as of 16:48, 20 August 20222,560 × 1,920 (99 KB)Morn (talk | contribs)sharpen image after downscaling
12:35, 20 August 2022Thumbnail for version as of 12:35, 20 August 20222,560 × 1,920 (98 KB)Morn (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata