Create your AI Cum Slut -70% for Mother's Day
x

Request Tool HTML Looking for a tool: extracting embedded base64 images from HTML games

beson

New Member
Dec 18, 2017
3
2
Hello, I'm looking for a way to extract images from HTML games that embed their images into the main html file. The image data is stored in base64 format inside the html page code. I can manually find the blocks of base64 code and paste them into any online decoder, one image at a time. But it's way too tedious.

I tried to find any programs that could parse the HTML file and convert the base64 code into proper image files, but so far I had no luck.

The closest I got was with a command-line tool that has "--extract-media" option that is supposed to do that. However, It only worked with simple html files that I made just for testing, with a few base64 images inside. Extracting from html files from the real games failed. I guess the tool just can't get past all the fancy game scripts code. The actual games I tried it with were Cambion [Chiakipus] and .

Does anyone know a tool that can extract the base64 images from HTML files automatically and in bulk?
 

Broguski13

New Member
Apr 26, 2025
3
1
Theoretically, You can make a rather simple script in Python to do the trick. Here is a code made by Gemini AI (tested it on Cambion - works perfectly as far as I can tell, attaching screenshots)
You don't have permission to view the spoiler content. Log in or register now.
You don't have permission to view the spoiler content. Log in or register now.

Python:
 import re import base64 import os html_file_path = 'your_game.html' # Path to your HTML file output_folder = 'extracted_images' # Folder to save images # Create output folder if it doesn't exist if not os.path.exists(output_folder):    os.makedirs(output_folder) try:    with open(html_file_path, 'r', encoding='utf-8') as f:        html_content = f.read()    # Regex to find base64 images (png, jpeg, gif, svg)    # It captures the format (group 1) and the base64 data (group 2)    pattern = r'data:image/(png|jpeg|gif|webp|svg\+xml);base64,([A-Za-z0-9+/=]+)'    matches = re.findall(pattern, html_content)    if not matches:        print("No embedded base64 images found.")    for i, match in enumerate(matches):        img_type = match[0]        base64_data = match[1]        # Handle potential SVG format naming        if img_type == 'svg+xml':            img_type = 'svg'        elif img_type == 'jpeg': # Use standard jpg extension            img_type = 'jpg'        # Decode the base64 string        try:            # Ensure padding is correct if needed (though regex often captures correctly padded strings)            # missing_padding = len(base64_data) % 4            # if missing_padding:            #    base64_data += '=' * (4 - missing_padding)            image_data = base64.b64decode(base64_data)        except base64.binascii.Error as e:            print(f"Error decoding image {i+1}: {e}. Skipping.")            continue        # Create filename        filename = f"image_{i+1}.{img_type}"        output_path = os.path.join(output_folder, filename)        # Save the image        try:            with open(output_path, 'wb') as img_file:                img_file.write(image_data)            print(f"Saved {output_path}")        except IOError as e:             print(f"Error saving image {i+1} to {output_path}: {e}") except FileNotFoundError:    print(f"Error: HTML file not found at {html_file_path}") except Exception as e:    print(f"An unexpected error occurred: {e}")
If you do not know how to download Python and make this code work you can DM me and I will help you as much as I can (Am vibe-coding using AIs' though so do not expect too much of tutoring)
 
Last edited: