Image to polygon converter

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Image to polygon converter

Post by Bigfoot71 »

Following a recent topic I had the motivation to do something I had already thought of a few times, to obtain polygons representing the convex hull of an sprite. So I made it a small tool for my personal use and I just wanted to share it if it can help people ^^

It's a little program (made with löve, yes) where you just drag and drop an image into the window and it generates the list of vertices you want, selecting the max number of vertices you want.

The code is CC0 except for the SUIT library and nativfs which is included (I don't know if that is a problem), so what is mentioned as CC0 at the top of the file means that you do what you want with it :awesome:

Small animated demo:
Image

Example of what an exported file may look like, the program creates the file or simply adds the new table to the file:

Code: Select all

-- Normal
verts_1 = {70, 10, 159, 55, 0, 139}

-- Table of table checked
verts_2 = {{x = 70, y = 10}, {x = 159, y = 55}, {x = 0, y = 139}}

-- Normal formated
verts_3 = {
  70, 10,
  159, 55,
  0, 139,
}

-- Table of table formated
verts_4 = {
  {x = 70, y = 10};
  {x = 159, y = 55};
  {x = 0, y = 139};
}
I thought about adding the possibility of converting a whole folder at once, spritesheet management and being able to edit the vertices in the previews, I'll try to add all this when I have time or don't do not hesitate to suggest your modifications on the repository if you like ^^
I will also propose releases for Windows and Linux on the repository when I have time too.

https://github.com/Bigfoot71/Image-to-Polygon-converter
Attachments
image-to-polygon-converter.love
(20.89 KiB) Downloaded 135 times
My avatar code for the curious :D V1, V2, V3.
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests