Skip to content

perf: minimize sprites#18

Closed
andreandersson wants to merge 1 commit intoprotomaps:mainfrom
andreandersson:perf/minimize-sprites
Closed

perf: minimize sprites#18
andreandersson wants to merge 1 commit intoprotomaps:mainfrom
andreandersson:perf/minimize-sprites

Conversation

@andreandersson
Copy link
Copy Markdown

The images can be minimized using TinyPNG. For v4, this gives us a saving of around 50%, but some images even more.

The images can be minimized using TinyPNG. For v4, this gives us
a saving of around 50%, but some images even more.

Signed-off-by: André Andersson <andre.andersson@zenon.se>
@bdon
Copy link
Copy Markdown
Member

bdon commented Feb 5, 2026

What "TinyPNG" are you referring to?

the original source for the sprites is https://github.com/protomaps/basemaps/tree/main/sprites , which also describes how to build the sprite sheets. This is a useful optimization but it needs to be integrated into that build process. Either we require the developer installs the tinypng tool, which depends on how widely available it is, or we need a PNG optimization alternative that can be called from the Rust program.

@andreandersson
Copy link
Copy Markdown
Author

Sorry for a late response here, been on vacation for awhile :)

TinyPNG in this case is a service: https://tinypng.com/

Haven't actually worked in Rust, but... There seems to be some API-clients written in rust specifically for TinyPNG (see tinify). But if we don't want the dependency on a service perhaps minipng could be something?

Perhaps we should close this PR and start a discussion / issue instead, if this isn't the solution we want? :)

@bdon
Copy link
Copy Markdown
Member

bdon commented Mar 10, 2026

I see hosting sprites on a third party like GitHub Pages as only a temporary solution, in the long term the best solution will be a SVG -> optimized PNG pipeline that bundles the sprites in the @protomaps/basemaps JS package: https://github.com/protomaps/basemaps/tree/main/styles

@bdon bdon closed this Mar 10, 2026
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.

2 participants