--- license: cc0-1.0 task_categories: - text-to-image tags: - art pretty_name: Factorio Blueprint Visualizations Dataset size_categories: - n<1K --- ## Dataset Description This dataset is a collection of visualizations of [Factorio Blueprints](https://wiki.factorio.com/Blueprint) using this Factorio Visualization Tool: https://github.com/piebro/factorio-blueprint-visualizer. The Blueprints are collected from https://www.factorio.school/. ## Dataset Structure * "svg_original": The svg downloaded like this from the website * "svg_rect": The svg reshaped to a rect and a slightly bigger border * "png_1024x1024": The svg_rect images exported as pngs ## Code Attachments Code to create the rectangular svgs: ```python import os import xml.etree.ElementTree as ET def modify_svg(save_dir, svg_file_path): tree = ET.parse(svg_file_path) root = tree.getroot() # Extract current width and height width = float(root.attrib['width'].replace('mm', '')) height = float(root.attrib['height'].replace('mm', '')) # Calculate new dimensions new_size = max(width, height) + 200 # Update width and height root.attrib['width'] = f"{new_size}mm" root.attrib['height'] = f"{new_size}mm" # Adjust viewBox for centering content view_box = root.attrib.get('viewBox', '').split(',') if len(view_box) == 4: x, y, vw, vh = map(float, view_box) dx = vw*0.12 dy = vh*0.12 root.attrib['viewBox'] = f"{x-dx/2}, {y-dy/2}, {vw+dx}, {vh+dy}" # Write back to file or a new file tree.write(os.path.join(save_dir, f"modified_{os.path.basename(svg_file_path)}")) save_dir = "" original_svg_folder_path = "" for file_name in os.listdir(original_svg_folder_path): if file_name.endswith('.svg'): modify_svg(save_dir, os.path.join(original_svg_folder_path, file_name)) ``` Code to create the pngs: ```bash mkdir pngs for file in *.svg; do convert "$file" -resize 1024x1024 "pngs/${file%.svg}.png"; done ```