Coder Social home page Coder Social logo

catdad-experiments / dcraw-vendored Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 232 KB

๐Ÿ‘Œ dcraw, already compiled for you

Shell 0.04% C 98.56% Batchfile 0.14% JavaScript 1.27%
npm-package dcraw photography images linux windows macos darwin

dcraw-vendored's Introduction

dcraw vendored

travis appveyor

This projects distributes the dcraw binary through a series of npm modules, in order to allow using the binaries through child_process. This project compiles and distributes binaries for the following operating systems:

If you don't want to think about operating systems, consider installing dcrawr instead, which integrates these modules.

All the modules can be in the following way:

const dcraw = require('dcraw-vendored-linux');
const { promisify } = require('util');
const { execFile } = require('child_process');

// call dcraw with any command line arguments you want
// bonus points: it's a promise now
promisify(execFile)(dcraw, ['-w', '-W', 'my-image.dng'])
  .then(result => {
    console.log(result);
  }).catch(err => {
    console.error(err);
  });

You might also want to get the image returned in standard out rather than written to a file. You can follow these general rules:

const dcraw = require('dcraw-vendored-linux');
const { promisify } = require('util');
const { execFile } = require('child_process');
const fs = require('fs');

// -c will write the data to stdout
promisify(execFile)(dcraw, ['-c', 'my-image.dng'], {
  // hide the extra window on Windows
  windowsHide: true,
  // we want the raw data, not a string
  encoding: 'buffer',
  // 8-bit PPMs are roughly 3x bigger than the original raw file
  // so you should set this number fairly high
  maxBuffer: 1024 * 1024 * 100
})
  .then(result => {
    // don't use the sync method... you get the idea though
    fs.writeFileSync('./my-image.ppm', result.stdout);
  }).catch(err => {
    console.error(err);
  });

Versions

The versions of these packages will follow the versions of dcraw itself. For example, version 9.28 of dcraw will be published as 9.28.x, with path versions reflecting updates to the surrounding module (likely related to the build, as there isn't much to the module itself). However, I do not know how dcraw itself is versioned, so I recommend pinning this dependency just in case.

All versions are compiled using NODEPS, so some functionality may not work. Please look at the original source code for information on what functionality is provided by dependencies. If you'd like to see any dependencies included, please feel free to submit a PR.

License

The original dcraw code by Dave Coffin is compiled without modifications. Regardless of modification, these modules are distributed under the GPL version 2 license, because that is what the header in the source code says and I do not want to get in trouble.

To the extent possible under law, I am waiving all copyright and related or neighboring rights to the build scripts and build-related code in this repository.

dcraw-vendored's People

Contributors

catdad avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

varunvfp

dcraw-vendored's Issues

Passing a Buffer instead of File

I'm reading a file from S3 and get it back as a Buffer, instead of calling dcraw with a physical file path as dcraw, ['-c', 'my-image.dng'], is it possible to pass a buffer of a file dcraw, ['-c', myBuffer]?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.