length
This commit is contained in:
@@ -19,7 +19,7 @@ var psd = use('psd')
|
|||||||
var qoi = use('qoi')
|
var qoi = use('qoi')
|
||||||
var aseprite = use('aseprite')
|
var aseprite = use('aseprite')
|
||||||
|
|
||||||
if (args.length < 2) {
|
if (length(args) < 2) {
|
||||||
log.console("Usage: cell run convert.ce <input_file> <output_file>")
|
log.console("Usage: cell run convert.ce <input_file> <output_file>")
|
||||||
log.console("Example: cell run convert.ce lenna.png lenna.qoi")
|
log.console("Example: cell run convert.ce lenna.png lenna.qoi")
|
||||||
log.console("Decode: png, jpg, bmp, tga, gif, psd, qoi, ase/aseprite")
|
log.console("Decode: png, jpg, bmp, tga, gif, psd, qoi, ase/aseprite")
|
||||||
@@ -49,7 +49,7 @@ function decode_image(blob, ext) {
|
|||||||
default:
|
default:
|
||||||
// Try common decoders as a fallback
|
// Try common decoders as a fallback
|
||||||
var decoders = [png.decode, jpg.decode, qoi.decode, aseprite.decode]
|
var decoders = [png.decode, jpg.decode, qoi.decode, aseprite.decode]
|
||||||
for (var i = 0; i < decoders.length; i++) {
|
for (var i = 0; i < length(decoders); i++) {
|
||||||
try {
|
try {
|
||||||
var r = decoders[i](blob)
|
var r = decoders[i](blob)
|
||||||
if (r) return r
|
if (r) return r
|
||||||
@@ -110,4 +110,4 @@ if (!success) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.console("Successfully converted " + input_file + " to " + output_file)
|
log.console("Successfully converted " + input_file + " to " + output_file)
|
||||||
log.console("Output size: " + text(encoded.pixels.length) + " bytes")
|
log.console("Output size: " + text(length(encoded.pixels)) + " bytes")
|
||||||
|
|||||||
Reference in New Issue
Block a user