Script created by Haloflooder. Idea thought up by CopherNeue
Description
Pixel Stats is a script that tells you the total amount of pixels for each color (outputs the RGB values) along with the percentage. It could be useful for people who are curious about what colors they are using the most for their artwork.
- Analyzes the image and spits out the data about the pixels!
- Lists the colors as a color group (red, orange, blue, etc)
- You also have the ability to analyze part of an image by using the select tool! (But see the bug section first)
Limitation
This script can only get the stats from the current layer you selected. The API isn't flexible enough for the script to get the stats from the entire image. To get the stats for the entire image, you need to flatten the layers to 1 layer.
DISCLAIMER
DO NOT use this script with an image with lots and lots of colors or LARGE images otherwise you will run the risk of crashing Aseprite. Pixel art should be fine for the most part unless you have more than 1000 colors. Save your project before you use the script!
Bugs
Aseprite crashes if the active layer you selected is only partially full. So there needs to be a background in the layer in order for the script to not crash Aseprite. The bug is caused by Aseprite's scripting ability so this issue cannot be fixed until Aseprite fixes the bug.
The selection feature only works with a single rectangle selection. Wands, polygons, multiple selections, etc won't work since the Aseprite scripting feature is still a WIP.
Requirements
Aseprite version v1.2.9 A text editing tool such as Notepad++, Atom, etc. Also, for the sake of your sanity. Don't use Microsoft Notepad. And some effort
Hi @haloflooder there thank you for sharing this information, I was not aware you can add your own scripts with Aseprite, do you think we can do image manipulation via scripts also?
Hello, it would also be good to calculate the time spent on the work, I mean to inform you about how much time you have spent so far.
Could it be done ?.
Could they do an official function with this information?
Hey there! I also didn’t know that you can add scripts to Aseprite until I decided to snoop around Aseprite’s github repo a couple days ago.
It is possible to do image manipulation but depending on what you do in the script, you could easily crash Aseprite. I think that might be a reason why the developers decided not to enable scripts by default. I will be making a demo script that contains lots of examples of what you can do with Aseprite. I’ll message you once I get it done
edit
Just found out that the scripting feature is extremely buggy. I will still release my demo script after I’m done experimenting with scripts but I suggest that no one should use it for production because it will crash Aseprite in many conditions.
edit 2
Here is a demo script that I made for Aseprite. I also made a wiki page on github that talks about how unstable scripts can be and what bugs I’ve discovered with Aseprite’s scripting feature.
Hi! Unfortunately, that’s currently not possible at the moment since scripts can’t run in the background. It would be better if the developers of Aseprite implements that feature to the software.
¡Hola! Lamentablemente, actualmente no es posible en este momento, ya que los scripts no se pueden ejecutar en segundo plano. SerĂa mejor si los desarrolladores de Aseprite implementan esa caracterĂstica en el software.
Pixel Stats v1.1 comes with a few new features and some optimized code to help it run a teensy bit faster! I have also included a minified version of a script if you want a smaller file size for some reason.
@haloflooder
Would it be possible to display a color swatch in the output, rather than a text label describing the color?
Or to output an image with text describing the pixels/percentage?
Thanks for the suggestion! It’s a pretty good idea but unfortunately, that wouldn’t be possible since I can’t display colors in errors console in 1.2.9.
I can possibly put colors in the Aseprite 1.2.10 but I have to play around with the new gui api first and see what it looks like.
I think that a possible way to report this information (+ colors) would be creating a new image/sprite, I should expose an API to draw text on the canvas and that might be a good start to create the new sprite showing the original sprite stats (or maybe adding more rich text experience to a Dialog textbox, e.g. markdown + images?)
Hello, could you add information on how many maximum colors are there per cell?
I use the division of cells in 8x8 pixels.
I would like to know if any of my cells have more than 3 colors.
Then the script could provide the following information:
Maximum colors in a cell = 4
Then I would discover that there is an error in my drawing.
Hola, ÂżpodrĂa añadir la informaciĂłn sobre cuantos colores maximos hay por celda?.
Yo uso la division de celdas en 8x8 pixeles.
Me gustarĂa saber si alguna de mis celdas tiene más de 3 colores.
Entonces el script podrĂa proporcionar la informaciĂłn siguiente:
Maximos colores en una celda = 4
Entonces yo descubrirĂa que hay un error en mi dibujo.
That’s an interesting idea and it definitely is doable. I looked into supporting multiple cels a few months ago but I didn’t implement it yet since the api was still a work in progress at the time.
In case anyone else gets stuck trying to use the script: if you are on Aseprite v1.2.10 or later, you need to use the Lua script version since JS isn’t supported anymore.