sprite sheet maker
Align embedded sprite pixels before passing the views to Pixelmatch
An archive parser can return an RGBA view with all the right colors and still fail a Pixelmatch comparison. In Pixelmatch 7.1.0, the input's starting byte offset must support its 32-bit typed-array view. That view needs four-byte alignment. Checking the length proves the payload size, but says nothing about its starting offset.
At the file boundary, record the pixel start and expected byte count for each cell. Accept a view only if it covers the complete rectangle. For an existing archive whose variable-length header leaves a frame unaligned, copy that exact view into a fresh byte array. If you also own the archive writer, you can reserve padding so future records begin on a four-byte boundary, with the offsets declared in the manifest.
Build a regression pack containing equal two-pixel fixtures at offsets one and four. Compare each with a candidate that changes one channel enough to register as a difference. The test should produce the same count through the archive parser, regardless of alignment. Also verify that the copied buffer excludes its header and trailer. technical guide and test fixture demonstrates the corresponding exception and successful comparison from the same eight pixel bytes.
Prepared by the FrameSprite Workflow Team with AI assistance. Examples are illustrative unless attributed to a linked fixture.