Skip to content

HQ_Images#224

Open
Adam-Kaan-Gambrill wants to merge 98 commits into
LazoVelko:masterfrom
Adam-Kaan-Gambrill:master
Open

HQ_Images#224
Adam-Kaan-Gambrill wants to merge 98 commits into
LazoVelko:masterfrom
Adam-Kaan-Gambrill:master

Conversation

@Adam-Kaan-Gambrill

Copy link
Copy Markdown

This script renames PNG files in the specified folder to include the Pokémon's Dex number and name.
I'm trying to rewrite the entire thing and compress it into a function.
Made function that takes all of the Pokédex numbered Pokémon in a folder and renamed them based on their Pokédex number.
Testing a way to list Pokemon based on their dex number, showing their name, type(s) and the average brightness of the image. Also testing making an automatic image brightness finder.
Pokemon types are now read out in a list so it doesn't break if there's an empty space for a single type Pokemon, and doesn't leave out the secondary typing of a dual type Pokemon.
Installed OpenCV to get the image opening working, haven't fully tested it, will make sure it works later.
NOW it can list the mean brightness value of every image in a folder.
I'm working on making my own text file that autofills the Dex number, Pokemon name, their brightness value, and type(s).

Need to see if it works, and it does, so next I'll be able to feed it info gathered from my other scripts.
To avoid redundant information, and to keep file size down, before the start of every loop the compilation file will be cleared so the loop itself can rewrite everything fresh.
Made a script that can change the colour of hidden pixels to ensure they are unreadable by my mean colour finder, and it  also makes semi-transparent pixels opaque and black so it gives the Pokémon a harder outline.
It ignores values with 0 opacity so it doesn't give skewed colour values due to the invisible black background.
Trying to make this function closer to the average colour finder, I want to make sure the brightness value isn't tainted by an invisible layer of flat colour.

I need to ignore the invisible pixels.
It works, but there's a lot of artifacting with the background, where it'll randomly be all white or all black, or even have patches of the opposite colour and one was even gray.

My test works for the most part, but the data is probably unusable, so I'm scrapping it for now.
Changed some of the values so it'd run with the improved function.
All of the brightness values have been updated, they should all be higher because it now ignores the black background which should've been transparent, but the old script didn't care what the opacity was.

Also I removed that extra empty tab space after each type, just a little QoL change that is completely invisible but it puts the happy chemicals in my brain anyway.
I want my script to be able to read this log, an ignore every file with a matching name, so it can automatically append to my other list, without having to redo the whole thing from scratch.

It's not working yet, and honestly it isn't all that necessary either, it's just something I want to do before Gen 10 comes out.
This script can open an image, convert it into grayscale and alpha channels, and then read its data.

It look through every pixel of an image using a loop, any pixels with 0 alpha will be ignored, and every other pixel will have its brightness appended into a list.

At the end of the loop, all values in the list are added together, then divided by the length of the list to find the average, then divided by 255 so that the output is between 0 and 1, and then it's rounded to the 3rd decimal place to look neater.
Some mega evolutions and all regional variants have different types than their normal forms, but because they also share the same Pokédex number, they'd copy the normal form's types.

I've made a list of every correction, so I can hopefully have my info compiler read from it.
Updated Pokémon type variations to use lists instead of strings.
It compiles dex number, name, brightness value, types and abilities perfectly fine, but the source of this information - PokeAPI - has inconsistent naming that breaks whenever I request information on Burmy or Oricorio's different forms, which is inconsistent with Rotom and Wormadam's forms which work perfectly fine.
I'm hoping that I can have my code try one URL, and if it fails, use the other version that should work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant