sprites icon indicating copy to clipboard operation
sprites copied to clipboard

ID/naming inconsistencies with certain forms image paths

Open jonbarrow opened this issue 4 months ago • 2 comments

There seems to be a number of Pokemon which use inconsistent naming conventions when referencing later generations

For example:

  • https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/10047.png
  • https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vii/ultra-sun-ultra-moon/214-mega.png

These are both images for Mega Heracross, though one path uses the heracross-mega Pokemon ID while the other uses the heracross species ID with -mega tacked on

  • https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/10120.png
  • https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-vii/icons/718-complete.png

These are both images for Complete Zygarde, though one path uses the zygarde-complete Pokemon ID while the other uses the zygarde species ID with -mega tacked on

  • https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/10035.png
  • https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/shiny/6-mega-y.png

These are both images for Mega Charizard Y, though one path uses the charizard-mega-y Pokemon ID while the other uses the charizard species ID with -mega-y tacked on. This is even more confusing, since these are the same image for the same generation, just one is shiny and one is not, so the naming convention is not even guaranteed to be the same within the same generation

This is typically not an issue if you are getting the URL from the API, but since not all images seem to be exposed via the API (see https://github.com/PokeAPI/pokeapi/issues/1281 for details) I have resorted to manually crafting the paths, which seems to be impossible to do conveniently. I've been implementing all the edge cases manually, but it is rather annoying to do, shouldn't the naming conventions be consistent?

jonbarrow avatar Aug 17 '25 20:08 jonbarrow

It seems like I can consistently get the paths I need by using form.form_name in these cases, so that's good, though it does still require an additional check to see if the path using the standard pokemon ID works first. Would still be nice to normalize these at some point

jonbarrow avatar Aug 17 '25 21:08 jonbarrow

Hi! I'm aware of the issue! At some point we merged a big contribution that had a different naming convention (with -mega, etc). We came up with this function: https://github.com/PokeAPI/pokeapi/blob/master/data/v2/build.py#L1427

We could change the logic or if someone has the time rename all -mega images.

Naramsim avatar Aug 18 '25 08:08 Naramsim