PSD (Photoshop, Krita, Gimp...) -> Godot.

Overview

limage v0.2.2

Features Getting Started Tags Settings Todo Customizer Changes Solutions

WARNING: Requires Python to be installed

PSD (Photoshop, Krita, Gimp...) -> Godot.

Example files included. You can delete everything outside the "addons" folder.

Design in your prefered art tool. How you lay it out is how you get it out!
layers1 layers3
Draw origins + spawn points to make life easier.
points1 points2

Auto generate convenient code.

layers2

Tell Godot what kind of node you want the layer to be.
node1 node2

Auto polygon scene generator (WIP)

polygons

Features

  • Convert PSD to images + layer info.
  • Auto-generate scene where layer positions, visibility, and opacity are preserved in Godot.
  • Add origins to make rotations easier.
  • Many image formats, like WEBP.
  • Scale, quantize, and optimize images.
  • Images auto cropped to minimum size.
  • Optionally merge layers at build time, so they can stay seperate in your psd.
  • Only builds if there were changes.
  • Helper scripts:
    • Button: Pixel perfect sprite clicking, without a mask. (Sprite can scale + rotate!).
    • Customizer: Script generator for customizable content.
    • Cursorize: Call set_layer_as_cursor("layer_name") to set any layer as the cursor. (Will use origin to offset).
  • Polygon generator. (WIP! see Tags)

Getting Started

pip3 install psd-tools
  • Create a layered_images folder in Godot. res://layered_images.
  • Add .psd files. (Krita and Gimp can export .psd)
  • Activate the plugin. (Project > Project Settings > Plugins > Limage)
  • Click Limage at top of screen. (next to 2D, 3D, Script, Asset Lib)
  • Click generate.
  • The textures will be placed in a textures folder, and the data in a data folder.

Populating Scene

  • Create a scene in Godot.
  • Add LimageNode.gd script to it.
  • Drag data/name-of-your-psd .tres into the limage field.
  • Click the force_update toggle twice.

That should work. You could remove the LimageNode.gd if you like.

Every time you double click force_update it will update. Useful if you made changes. But it won't delete nodes. You can manually delete all the children to clear, and do a fresh generation.

Tags

Add tags in layer names, between []: layer_name [tag_1 tag2 tag-3]

Use () to set tags for all children. layer_group [tag1] (tag2 tag3)

Use (()) to set tags for all descendants. buttons ((button))

Tags can have values: background [parallax=10] which you can then get in Godot with limage.get_layer("background").tags.get("parallax").

  • x: Completely ignore layer. (Wont export image or layer info.)
  • visible: Will make layer visible, regardless of it's state in the psd.
  • !visible: ^
  • point: Won't generate an image, but will create an empty node in the scene. Useful for spawn points.
  • origin: Sets the origin of the parent group. If no parent, sets the global origin.
  • poly: (WIP!) Will generate a polygon scene. (Requires opencv-python and numpy)
  • button: Makes a clickable sprite button.
  • node: Tells Godot what node to use. my_light [node=Light2D]

These tags can be used on group layers.

  • origins: Children will be treated as points and used for layer origins, for easier rotations + scaling.
  • merge: "Flatten" children into one image.
  • options: Treat children as options for a sprite. (good for customizable objects.)
  • toggles: Treat children as optional child sprites that will be added/removed if enabled/disabled.

Settings

Export settings can be tweaked by including a json file next to the psd, with an identical name.

So next to layered_images/my_picture .psd include layered_images/my_picture .json with your settings.

# default settings
"path": "",						# location of psd if not in directory. (not implemented yet)
"seperator": "-",				# change to "/" and images will be stored in subfolders instead.

"texture_dir": None,			# if set, saves textures here
"data_dir": "data",				# if set, saves layer data here

# rescale textures
"scale": 1,

# in range of 0.0 - 1.0. makes rotation + flipping easier.
# creating a layer with an "origin" tag will replace this. 
"origin": [0, 0],

# you can choose any image format pillow + Godot support.
# but PNG, WEBP, and JPG are probably the most common.
# https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html
# https://docs.godotengine.org/en/stable/getting_started/workflow/assets/importing_images.html
"format": "WEBP", # WEBP can be A LOT smaller than png. and Godot supports it.

# can really decrease file size, but at cost of color range.
# https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.quantize
"quantize": False,

# default texture format settings
"PNG": {
	"optimize": True,
},

"WEBP": {
	"lossless": True,
	"method": 3,
	"quality": 80
},

"JPEG": {
	"optimize": True,
	"quality": 80
}

Todo

  • Better documentation.
  • Finalize polygon generator.
  • Normal map generation.
  • Blend mode shaders.
  • Optional padding for textures.
  • Text placement + preservation. (I only work with krita, which doesn't preserve text info when converting to psd.)

Customizer

If you include an options or toggles tag in any layer, a Godot script will be generated to make layer manipulation easier.

You can then replace LimageNode.gd with it.

You should override this rather than add code to it, as it will be replaced when regenerating.

Changes

0.2.2

  • Added node tag, so you can tell Godot what Node to use.
  • LimageNode now properly uses local coordinates, so it can be a child, rotated, scaled, without problems.
  • LimageNode options and toggles fields now work in editor more stabily.
  • LimageNode toggles initial visibility is fixed.

0.2.1

  • Editor should reload files properly now.

0.2

  • Saving + loading should work better on Windows.
  • Fixed merge tag still generating child textures.
  • Fixed JPEG error because of no alpha channel.
  • Fixed polygon generation not working with some image formats.
  • If settings file is changed, image will be rebuilt.

Solutions

WEBP

If WEBP exporting isn't working, try installing, reinstalling, or updating PILLOW, and/or libwebp:

On Ubuntu:

sudo apt-get install -y libwebp-dev
A simple plugin to view APR images in napari

napari-apr-viewer A simple plugin to view APR images in napari This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-

5 Jan 24, 2022
A Python package implementing various CFA (Colour Filter Array) demosaicing algorithms and related utilities.

Colour - Demosaicing A Python package implementing various CFA (Colour Filter Array) demosaicing algorithms and related utilities. It is open source a

colour-science 218 Dec 04, 2022
Archive of the image generator stuff from my API

alex_api_archive Archive of the image generator stuff from my API FAQ Q: Why? A: Because I am removing these components from the API Q: How do I run i

AlexFlipnote 26 Nov 17, 2022
👷 Build images with images

👷 Build images with images. About Tiler is a tool to create an image using all kinds of other smaller images (tiles). It is different from other mosa

5.5k Jan 03, 2023
Open source software for image correlation, distance and analysis

Douglas-Quaid Project Open source software for image correlation, distance and analysis. Strongly related to : Carl-Hauser Problem statement (@CIRCL)

Dominik Dancs 2 May 01, 2022
Dynamic image server for web and print

Quru Image Server - dynamic imaging for web and print QIS is a high performance web server for creating and delivering dynamic images. It is ideal for

Quru 84 Jan 03, 2023
Simple AI app that is guessing color of apple in picture

Apple Color Determinant Application that is guessing color of apple from image Install Pillow, sklearn and numpy, using command for your package manag

Gleb Nikitin 1 Oct 25, 2021
PyGtk Color - A couple of python scripts to select a color (for scripting usage)

Selection Scripts This repository contains two scripts to be used within a scripting project, to aquire a color value. Both scripts requir

Spiros Georgaras 1 Oct 31, 2021
Extracts random colours from an image

EXTRACT COLOURS This repo contains all the project files. Project Description A Program that extracts 10 random colours from an image and saves the rg

David .K. Danso 3 Dec 13, 2021
Script for the creation of metadatas and the randomization of images of MekaVerse

MekaVerse-random Script for the creation of metadata and the randomization of images of MekaVerse Step to replay the random : Create a folder : output

Miinded 8 Sep 07, 2022
Visage Differentiation is a GUI application for outlining and labeling the visages in an image.

Visage Differentiation Visage Differentiation is a GUI application for outlining and labeling the visages in an image. The main functionality is provi

Grant Randa 0 Jan 13, 2022
Image Processing - Make noise images clean

影像處理-影像降躁化(去躁化) (Image Processing - Make Noise Images Clean) 得力於電腦效能的大幅提升以及GPU的平行運算架構,讓我們能夠更快速且有效地訓練AI,並將AI技術應用於不同領域。本篇將帶給大家的是 「將深度學習應用於影像處理中的影像降躁化 」,

2 Aug 04, 2022
Automatic picture transmission(APT) protocol decoder for NOAA weather satellites

Automatic picture transmission(APT) decoder Automatic picture transmission protocol is used by NOAA satellites. They constantly send a frequency modul

Jayachandra Kasarla 25 Aug 05, 2022
Validate arbitrary image uploads from incoming data urls while preserving file integrity but removing EXIF and unwanted artifacts and RCE exploit potential

Validate arbitrary base64-encoded image uploads as incoming data urls while preserving image integrity but removing EXIF and unwanted artifacts and mitigating RCE-exploit potential.

A3R0 1 Jan 10, 2022
Black-white image converter - Black-white photo colorization

Black-white image converter - Black-white photo colorization

1 Jan 02, 2022
利用近邻法的弱点实现图片缩小后变成另一张图

这是我一个视频的配套代码。 视频是:利用近邻法的弱点实现图片缩小后变成另一张图 https://www.bilibili.com/video/BV1Lf4y1r7dZ 配套代码中,仅generate.py是核心文件,其余的图片神马的,都是赠品。 这个核心文件利用了近邻法缩放的弱点,可以将图a的像素按

偶尔有点小迷糊 182 Dec 19, 2022
ImageStrike是一款用于CTF中图片隐写的综合利用工具

🎈 简介 ImageStrike是一款使用PyQT5开发,用于CTF中图片隐写的综合利用工具

zR00t1 133 Dec 27, 2022
🛹 Turn an SVG into an STL for stencil creation purposes

svg2stl This repository provides a script which takes as input an SVG such as this one: It outputs an STL file like this one: You can also see an inte

Max Halford 3 Dec 29, 2021
An executor that performs standard pre-processing and normalization on images.

An executor that performs standard pre-processing and normalization on images.

Jina AI 6 Jun 30, 2022
View images in the terminal using ansi escape codes and python

terminal-photo-viewer view images in the terminal using ansi escape codes and python !! Only tested on Ubuntu 20.04.3 LTS with python version 3.8.10 D

1 Nov 30, 2021