Skip to content

feat(images): make a thumbnail of an image - #1

Closed
arjendevos wants to merge 1 commit into
mainfrom
feat/images
Closed

arjendevos wants to merge 1 commit into
mainfrom
feat/images

Conversation

@arjendevos

Copy link
Copy Markdown
Contributor

An images package with MakeThumbnail(source, longest): decode, scale down to a longest side keeping proportions, encode as png when the source was png and jpeg otherwise. Scaling is golang.org/x/image/draw Catmull-Rom, the one new dependency. An image already small enough comes back at its own size; bytes that are not an image answer ErrNotAnImage.

Needed by contentpad, which stores a small copy beside every image asset; it was scaling by hand in app code, which is the wrong place for it.

MakeThumbnail scales an image down to a longest side, keeping its
proportions, png when the source is png so transparency survives and
jpeg otherwise. Scaling is golang.org/x/image's Catmull-Rom.
@arjendevos

Copy link
Copy Markdown
Contributor Author

Wrong place: providers is the contract and its adapters. Image work lives in the app.

@arjendevos arjendevos closed this Sep 22, 2026
@arjendevos
arjendevos deleted the feat/images branch September 22, 2026 08:53
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