简体   繁体   中英

Converting raw images with Electron js

I'd like to build an Electron app that batch converts raw (CR2 in specific) images to JPG and than resizes them. But all the image processing libraries I've seen use some external image processing library such as imagemagick. Is there a way to ship these libraries along the Electron app, or work around them?

Not exactly sure what you are asking for, but you can call external libraries with

var remote = require('remote');
var exec = remote.require('child_process').exec;

var cmd = "start imagemagick.exe -arguments"

exec(cmd, function(err,stdout, stderr){
   //callback code
});

Edit: Also this exists. https://github.com/yourdeveloper/node-imagemagick

install alongside with npm install imagemagick

On the Mac there's a command-line program called sips which basically exposes the same libraries that Aperture and Photos use.

https://coderwall.com/p/nhp7mq/convert-raw-photos-to-jpg-in-the-mac-os-terminal

eg

for i in *.CR2; do sips -s format jpeg $i --out "${i%.*}.jpg"; done

Obviously (a) this is Mac only and Apple has marked it as "deprecated" in its developer documentation and (b) it only supports whatever cameras are supported in the OS version you're using (so users of older Macs won't have support for the latest proprietary files).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM