Documentation
¶
Overview ¶
Package coverart reshapes a cover-art image without scaling it. YouTube composites an Art Track's square release art onto a 16:9 canvas and letterboxes that canvas into a 4:3 variant, so the delivered bytes carry background pillars and black rows as pixels rather than metadata. Peeling those bars and center- cropping what remains recovers the art exactly; a resize would squash it.
It is stdlib-only and pure: bytes in, bytes out, no network and no filesystem.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dimensions ¶
Dimensions reports an image's pixel size from its header, without decoding it.
func Square ¶
Square crops an image down to its art: it peels uniform-color borders, then center-crops what remains to a square. It never scales, so the art keeps its proportions.
The result is square within 1%, not exactly square: an input already that close is returned untouched rather than re-encoded for a one-pixel difference. Output keeps the input's format, JPEG in / JPEG out and PNG in / PNG out.
It never returns nil bytes. On any failure it returns data unchanged along with a non-nil error, so a caller can embed the result unconditionally and treat the error as a report of a degraded result rather than a dropped one.
Types ¶
This section is empty.