How to use the pngjs.PNG.name function in pngjs

To help you get started, we’ve selected a few pngjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github omnisci / mapd-charting / test / be_render_tests / utils / ImageCompareReporter.js View on Github external
'Image must be a base-64 byte array or a filename');

      if (golden_image_name instanceof String ||
          typeof golden_image_name === 'string') {
        if (!path.isAbsolute(golden_image_name)) {
          golden_image_name =
              path.join(reporter.golden_img_dir, golden_image_name);
        }
      } else {
        chai.assert(
            golden_image_name instanceof Uint8Array ||
                golden_image_name instanceof TRenderResult ||
                golden_image_name instanceof PNG,
            `Image to match must be a ${String.name} path, ${
                Uint8Array.name} buffer, ${TRenderResult.name}, or a ${
                PNG.name}. It is of type ${typeof golden_image_name}.`);
      }
      const fileprefix = crypto.randomBytes(5).toString('hex');

      const src = readImage(image);
      const dst = readImage(golden_image_name);

      src.filename =
          path.join(image_dir, fileprefix + '-src.' + src.format.toLowerCase());
      copyImage(image, src.filename);

      dst.filename =
          path.join(image_dir, fileprefix + '-dst.' + dst.format.toLowerCase());
      copyImage(golden_image_name, dst.filename);

      const diff_file = path.join(
          image_dir, fileprefix + '-diff.' + src.format.toLowerCase());

pngjs

PNG encoder/decoder in pure JS, supporting any bit size & interlace, async & sync with full test suite.

MIT
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis