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
Python class that generates pixel art from images

Python class that generates pixel art from images

Richard Nagyfi 1.4k Dec 29, 2022
Simple Python package to convert an image into a quantized image using a customizable palette

Simple Python package to convert an image into a quantized image using a customizable palette. Resulting image can be displayed by ePaper displays such as Waveshare displays.

Luis Obis 3 Apr 13, 2022
Anime2Gif - an algorithm that detects scenes in a video and generates gifs from it

Anime2Gif Anime2Gif is an algorithm that detects scenes in a video and generates gifs from it. How to use To use it, first, you'll need to install it'

1 Dec 09, 2021
reversable image censoring tool

StupidCensor a REVERSABLE image censoring tool to reversably mosiac censor jpeg files to temporarily remove image details not allowed on most websites

2 Jan 28, 2022
LabelMe annotation tool source code

LabelMe annotation tool source code Here you will find the source code to install the LabelMe annotation tool on your server. LabelMe is an annotation

MIT CSAIL Computer Vision 1.3k Jan 03, 2023
LSB Image Steganography Using Python

Steganography is the science that involves communicating secret data in an appropriate multimedia carrier, e.g., image, audio, and video files

Mahmut Can Gönül 2 Nov 04, 2021
SALaD (Semi-Automatic Landslide Detection) is a landslide mapping system

SALaD (Semi-Automatic Landslide Detection) is a landslide mapping system. SALaD utilizes Object-based Image Analysis and Random Forest to map landslides.

NASA 14 Jan 04, 2023
With this simple py script you will be able to get all the .png from a folder and generate a yml for Oraxen

Oraxen-item-to-yml With this simple py script you will be able to get all the .png from a folder and generate a yml for Oraxen How to use Install the

Akex 1 Dec 29, 2021
Alternate Python bindings for the Open Asset Import Library (ASSIMP)

Impasse A simple Python wrapper for assimp using cffi to access the library. Requires Python = 3.7. It's a fork of PyAssimp, Assimp's official Python

Salad Dais 3 Sep 26, 2022
Music Thumbnail Maker

Music Thumbnail Installing pip install TMFrame

krypton 4 Jan 28, 2022
Fast Image Retrieval is an open source image retrieval framework

Fast Image Retrieval is an open source image retrieval framework release by Center of Image and Signal Processing Lab (CISiP Lab), Universiti Malaya. This framework implements most of the major binar

CISiP Lab 39 Nov 25, 2022
Seeks to remove text from an image in a convincing way.

Text-Removal This is a Computer Vision project that seeks to successfully remove text from an image by covering the text areas in a convincing way. He

6 Nov 22, 2022
sK1 2.0 cross-platform vector graphics editor

sK1 2.0 sK1 2.0 is a cross-platform open source vector graphics editor similar to CorelDRAW, Adobe Illustrator, or Freehand. sK1 is oriented for prepr

sK1 Project 238 Dec 04, 2022
BeeRef — A Simple Reference Image Viewer

BeeRef — A Simple Reference Image Viewer BeeRef lets you quickly arrange your reference images and view them while you create. Its minimal interface i

Rebecca 245 Dec 25, 2022
Python pygame project that turns your images to matrix rain

Matrix-Rain-An-Image This project implements the classic Matrix digital rain effect in python with pygame to build up an image provided with multiple

7 Dec 11, 2022
Short piece of code to create a rainbow gif of gradual contours from two shapefiles

rainbow-elevation-gif Short piece of code to create a rainbow gif of gradual con

Jess Roberts 6 Jan 17, 2022
Image Compression GUI APP Python: PyQt5

Image Compression GUI APP Image Compression GUI APP Python: PyQt5 Use : f5 or debug or simply run it on your ids(vscode , pycham, anaconda etc.) socia

Sourabh Dhalia 1 May 21, 2022
👾 Python project to help you convert any image into a pixel art.

👾 Pixel Art Generator Python project to help you convert any image into a pixel art. ⚙️ Developer's Guide Things you need to get started with this co

Atul Anand 6 Dec 14, 2022
Python-based tools for document analysis and OCR

ocropy OCRopus is a collection of document analysis programs, not a turn-key OCR system. In order to apply it to your documents, you may need to do so

OCRopus 3.2k Jan 04, 2023
Repair broken bookmarks to referenced files in Apple Photos

Repair Apple Photos Bookmarks Work in progress to repair file location bookmarks in Apple Photos. Background Starting in macOS 10.15/Catalina, photos

Rhet Turnbull 10 Nov 03, 2022