Retrieve animated 3D Pokemon sprite GIFs as base64 strings. Supports front, back, normal, and shiny variants for every Pokemon.
- Animated 3D GIF sprites for every Pokemon
- Four sprite variants โ front-normal, front-shiny, back-normal, back-shiny
- Base64 output โ ready to embed directly in
<img>tags - TypeScript support โ fully typed API with exported interfaces
- Lightweight โ minimal dependencies, simple async API
- Batch retrieval โ fetch all four variants of a Pokemon in a single call
npm install pokemon3d-image-resolverimport { getPokemon, PokemonData } from "pokemon3d-image-resolver";
const myPokemon: PokemonData = {
name: "pikachu",
version: "front-shiny",
};
const imageData = await getPokemon(myPokemon);
if (imageData) {
console.log("Base64 image data:", imageData);
} else {
console.log("Pokemon image not found.");
}import { getAllPokemonVersions } from "pokemon3d-image-resolver";
const allSprites = await getAllPokemonVersions("pikachu");
console.log(allSprites["front-normal"]); // base64 string or null
console.log(allSprites["front-shiny"]);
console.log(allSprites["back-normal"]);
console.log(allSprites["back-shiny"]);const base64Image = await getPokemon({
name: "charizard",
version: "front-shiny",
});
// Use directly in an img tag
const imgTag = `<img src="${base64Image}" alt="Charizard" />`;Fetches a single Pokemon sprite and returns it as a base64-encoded data URI.
| Parameter | Type | Description |
|---|---|---|
data.name |
string |
Pokemon name in English (lowercase) |
data.version |
string |
Sprite variant (see below) |
Returns: Promise<string | null> โ Base64 data URI string, or null if not found.
Fetches all four sprite variants for a given Pokemon.
| Parameter | Type | Description |
|---|---|---|
name |
string |
Pokemon name in English (lowercase) |
Returns: An object with keys front-normal, front-shiny, back-normal, back-shiny, each mapping to a base64 string or null.
| Version | Description |
|---|---|
front-normal |
Standard front-facing sprite |
front-shiny |
Shiny front-facing sprite |
back-normal |
Standard back-facing sprite |
back-shiny |
Shiny back-facing sprite |
const { getPokemon, getAllPokemonVersions } = require("pokemon3d-image-resolver");
const express = require("express");
const app = express();
app.get("/pokemon/:name", async (req, res) => {
const { name } = req.params;
try {
const image = await getPokemon({ name, version: "front-normal" });
if (image) {
res.send(`<img src="${image}" alt="${name}" />`);
} else {
res.status(404).send("Pokemon not found.");
}
} catch (error) {
res.status(500).send("Internal server error");
}
});
app.get("/pokemon/:name/all", async (req, res) => {
const { name } = req.params;
try {
const versions = await getAllPokemonVersions(name);
let html = `<h1>${name}</h1>`;
for (const [variant, data] of Object.entries(versions)) {
if (data) {
html += `<h2>${variant}</h2><img src="${data}" alt="${variant}" />`;
}
}
res.send(html);
} catch (error) {
res.status(500).send("Internal server error");
}
});
app.listen(3000, () => console.log("Server running on port 3000"));Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m "Add my feature") - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
If you encounter any bugs or have feature requests, please open an issue.
This project is licensed under the ISC License.