imagelib.rawToJPEG.js 668 B

123456789101112131415161718192021222324
  1. console.log("RAW to JPEG Conversion Test");
  2. //To test this, put a RAW photo (e.g. test.ARW / test.CR2 / test.DNG) on your desktop
  3. var srcPath = "user:/Desktop/test.ARW";
  4. var destPath = "user:/Desktop/test.jpg";
  5. //Check if the file exists
  6. requirelib("filelib");
  7. if (!filelib.fileExists(srcPath)){
  8. sendResp("File not exists!")
  9. }else{
  10. //Require the image library
  11. var loaded = requirelib("imagelib");
  12. if (loaded) {
  13. //Library loaded. Call to the functions
  14. var success = imagelib.rawToJPEG(srcPath, destPath);
  15. if (success){
  16. sendResp("OK")
  17. }else{
  18. sendResp("Failed to convert RAW to JPEG");
  19. }
  20. } else {
  21. console.log("Failed to load lib: imagelib");
  22. }
  23. }