Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@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-0
clock-1-0
clock-2-0
clock-0-1
clock-1-1
clock-2-1
So 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:
8x1
8x2
8x3
8x4
8x5
8x6
8x7
8x8
8x9
8x10
8x11
8x12
8x13
8x14
8x15
16x16
Provide 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.