Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

My Friend Koo (PC) - RLE images

Featured Replies

Solved by Rabatini

  • Supporter
14 hours ago, ikskoks said:

Just curious about those RLE images from old 1997 PC game "My Friend Koo".

 

My Friend Koo RLE samples.zip 649.66 kB · 5 downloads

It's similar to PCX/PackBits, where bytes 0xC0–0xFF indicate a repetition and the remaining ones are literal bytes.
PCX-style RLE: bytes >= 0xC0 specify a repetition count (byte & 0x3F) for the following byte.

A 256-color RGB palette is located in the last 768 bytes of the file.

Standard image size is 640x480, with a short prefix/header preceding the pixel data.

TITLE_decoded.png.73186e7b822c9626c398d3768e2d5ff8.png
1STE.png.8cdbfb399f7ee1ccb07f97e025b465b7.png1STE0.png.6035112fdb358f7c7600cdd21f3ce712.png

Edited by Rabatini

  • Supporter
  • Solution
def pcx_style_rle_decode(data):
    out = bytearray()
    i = 0
    n = len(data)
    while i < n:
        b = data[i]
        i += 1
        if b >= 0xC0:
            count = b & 0x3F
            value = data[i]
            i += 1
            out.extend([value] * count)
        else:
            out.append(b)
    return bytes(out)

def decode_rle_image(filepath, width=640, height=480, offset=None):
    with open(filepath, 'rb') as f:
        raw = f.read()
    palette_size = 768
    if len(raw) <= palette_size:
        raise ValueError("Arquivo muito pequeno, não tem dados de imagem + paleta.")
        
    compressed = raw[:-palette_size]
    palette = raw[-palette_size:]
    
    decoded = pcx_style_rle_decode(compressed)
    expected_pixels = width * height

    # Gambiarra caso o offset não seja informado: pega o final dos dados descompactados
    if offset is None:
        offset = len(decoded) - expected_pixels
        if offset < 0:
            offset = 0

    pixels = decoded[offset: offset + expected_pixels]
    return pixels, palette, offset


Here the essential! 

Let me know if you need the complete tool.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.