
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@chipcode/image-loader
Advanced tools
Either a stand alone tool or a plugin to Octopus to load image files
This tool can be used on the command line or as a plugin to Octopus. It allows you to convert image files into sprite data with labels and bytes, in a format that is compatible with the Octo assembler.
Install as an NPM package, either for a project or globally:
npm install --save-dev @chipcode/image-loader
You can then convert images on the command line:
npx image-loader path/to/some-file.png <optional modifiers>
Which will output the assembly code to stdout.
Or you can use it through Octopus like so:
:include "path/to/some-file.png" <optional modifiers>
This image loader supports all file types that are supported by JIMP, which is used for the file loading under the hood. Currently those file types are:
Let's say you convert or include, for example, a file called clock.png that is
24 pixels wide and 16 pixels high. Given the dimensions, the image loader will
guess that you want to have six 8x8 sprites. So the following labels will be
generated, which relate to the X and Y position of the sprite within the image:
clock-0-0clock-1-0clock-2-0clock-0-1clock-1-1clock-2-1So in this example, clock-2-0 is the top-rightmost 8x8 sprite.
If you don't want the image loader to generate these labels, provide the
no-labels modifier.
Modifiers are keywords that you provide to the image loader in any order, that influence how it converts your image.
The image loader tries to make an educated guess as to what resolution sprites you are trying to get out of the input image. It may not always guess correctly. Provide one of the following strings as a modifier, and the image loader will cut the image into sprites of the requested dimensions:
8x18x28x38x48x58x68x78x88x98x108x118x128x138x148x1516x16Provide the modifier no-labels to suppress the sprite labels in the output.
For example if you don't need the labels because you are dynamically calculating
the offsets into the image, they just clutter up your code. And while they don't
do any harm, they do unnecessarily make your source files longer.
Provide the word debug as a modifier to let the image loader output the image
to the console, as well as the selected sprite resolution and all the sprites
that it has cut from the image. This quickly and easily lets you inspect if the
conversion was a success, and everything went as you expected.
FAQs
Either a stand alone tool or a plugin to Octopus to load image files
We found that @chipcode/image-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.