piebro/factorio-blueprint-visualizations-sdxl-lora
Text-to-Image
•
Updated
•
7
•
•
1
image
image |
---|
This dataset is a collection of visualizations of Factorio Blueprints using this Factorio Visualization Tool: https://github.com/piebro/factorio-blueprint-visualizer. The Blueprints are collected from https://www.factorio.school/.
The dataset was used to train this lora: https://huggingface.co/piebro/factorio-blueprint-visualizations-sdxl-lora
Code to create the rectangular svgs:
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:
mkdir pngs
for file in *.svg; do convert "$file" -resize 1024x1024 "pngs/${file%.svg}.png"; done