Giter Site home page Giter Site logo

unix-toolbox.js's Introduction

Introduction

The unix-toolbox.js is a port of many popular Unix command line tools to Javascript using Mozilla's emscripten project. It runs completely on the client-side and requires WebWorker support in the client's browser.

Currently Supported Commands

  • GnuPG
    • gpg OpenPGP encryption and signing tool
  • ImageMagick
    • composite overlaps one image over another.
    • conjure interprets and executes scripts written in the Magick Scripting Language (MSL).
    • convert convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.
    • identify describes the format and characteristics of one or more image files.
    • mogrify resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more. Mogrify overwrites the original image file, whereas, convert(1) writes to a different image file.
    • montage create a composite image by combining several separate images. The images are tiled on the composite image optionally adorned with a border, frame, image name, and more.
    • stream a lightweight tool to stream one or more pixel components of the image or portion of the image to your choice of storage formats.
  • Poppler
    • pdfdetach Portable Document Format (PDF) document embedded file extractor
    • pdffonts Portable Document Format (PDF) font analyzer
    • pdfimages Portable Document Format (PDF) image extractor
    • pdfinfo Portable Document Format (PDF) document information extractor
    • pdfseparate Portable Document Format (PDF) page extractor
    • pdftohtml program to convert PDF files into HTML, XML and PNG images
    • pdftoppm Portable Document Format (PDF) to Portable Pixmap (PPM) converter
    • pdftops Portable Document Format (PDF) to PostScript converter
    • pdftotext Portable Document Format (PDF) to text converter
  • File
    • file determine file type
  • XZ Utils
    • xz Compress or decompress .xz files
    • xzdec Small .xz decompressor

Example

The Javascript class Interface can be used to initiate a WebWorker and communicate with it.. This is an example from ImageMagick's convert tool that loads some XML files required by ImageMagick and then loads the image test.png, rotates it and converts it to JPEG format:

<script src="toolbox-base/interface.js"></script>
<script>
  var convert = new Interface('convert-worker.js');

  // print convert output to console
  convert.on_stdout = function(txt) { console.log(txt); };
  convert.on_stderr = function(txt) { console.log(txt); };

  // load ImageMagick's configuration files
  convert.mkdir('/', 'usr/local/etc/ImageMagick').then(function() {
    convert.addUrl('./src/config/magic.xml',   '/usr/local/etc/ImageMagick', 'magic.xml');
    convert.addUrl('./src/config/coder.xml',   '/usr/local/etc/ImageMagick', 'coder.xml');
    convert.addUrl('./src/config/policy.xml',  '/usr/local/etc/ImageMagick', 'policy.xml');
    convert.addUrl('./src/config/english.xml', '/usr/local/etc/ImageMagick', 'english.xml');
    convert.addUrl('./src/config/locale.xml',  '/usr/local/etc/ImageMagick', 'locale.xml');
    convert.addUrl('./src/config/delegates.xml',  '/usr/local/etc/ImageMagick', 'delegates.xml');

    // load image to convert
    convert.addUrl('demo/test.png', '/', 'test.png');

    convert.allDone().then(function() {
      convert.run('-rotate', '90', '/test.png', '/test-rotated-90.jpg').then(function() {
        convert.getFile('/', 'test-rotated-90.jpg').then(function(contents) {

          var img = document.createElement("img");
          img.src = "data:image/jpeg;base64,"+window.btoa(contents);

          var body = document.getElementsByTagName("body")[0];
          body.appendChild(img);
        });
      });
    });
  });
</script>

unix-toolbox.js's People

Contributors

manuels avatar

Stargazers

Jeremy Polansky avatar FlyingRedPig avatar  avatar  avatar Alex Poone avatar Logan King (DarkComet) avatar Florian Lefebvre avatar adamz avatar Isaac Karth avatar Shubhendu avatar Itoroabasi Unang avatar Alexis Roe avatar 簡煒航 (Weihang Jian) avatar Berk Özdemir avatar Eddie Hsu avatar George Yong avatar Richard Lynch avatar cffmchn avatar Wildan Zulfikar avatar Martin Milan avatar Levi Buzolic avatar Helio Machado avatar e-monson avatar Heber Uriegas avatar Russell Warner avatar Seb avatar ik9999 avatar  avatar Blue Chen avatar  avatar liuyanghejerry avatar Yuri Dias avatar Konovalov Nikolay avatar Allan Jiang avatar Ryan Martin avatar  avatar  avatar kim avatar Jeremy Kohn avatar Alejandro Wainzinger avatar Chris Hart avatar Josh Buchea avatar Sanjeev Pandey avatar  avatar Pat avatar Danil Karpov avatar Nicolas Langley avatar Myles Shannon avatar Michael Anthony avatar Noitidart avatar Iain avatar ericodc avatar Dan McCabe avatar shancci avatar  avatar Julien Sanchez avatar Peter Kadlot avatar  avatar Marc avatar Shaon Diwakar avatar Gregory Benner avatar Hemanta Sapkota avatar Chris Dopuch avatar Arve Nygård avatar Maxim Orlovsky avatar Tom Byrer avatar Maksim Lin avatar Andrea Parodi avatar Jonas Hermsmeier avatar GyuYong Jung avatar Andrey Sidorov avatar Yosh avatar Kevin Coughlin avatar Matt Mueller avatar Eugene Ware avatar Nikos M. avatar  avatar LI Xuzhang avatar Jacob Beard avatar

Watchers

 avatar  avatar Borrey Kim avatar Alexandre MOTTET avatar James Cloos avatar  avatar Michael Anthony avatar Helio Machado avatar  avatar  avatar

unix-toolbox.js's Issues

Use in ChromeWorker

I was thinking of using this in ChromeWorker for firefox addon. My needs were very basic, I am XHR'ing a file in, its either png, jpeg, or tiff, maybe gif but probably not.

But after loading I need to get the byte data/imagedata.

Then with imagedata's of multiple files i need to:

  • get height/width
  • overlap some at various x/y within a base imagedata
  • scale up/down some
  • save as png

It seems this can handle all of that, but it has tons of other stuff which is awesome. But basically, i couldn't find how to pass in arraybuffer of png/jpeg/tiff and get back bytedata, is it possible with this?

Thanks

Current status

Hi,

I would like to know what is the current status of those project and in particular the "unix-toolbox.js-imagemagick" ? Is it active and working ?

Regards

Can you update this?

Hello,
Can you update this to work with an iphone 6s or newer that takes larger photos? I tried your demo page with my phone and it tries to read the image but I think based on the error that the image is too large to process.

I am checking around for code like this to use in an upcoming project. I ultimately need to be able to read a vehicle VIN barcode from newer mobile devices and have it decode the VIN number from the image.

If you can help with an update that would be cool. Thank you for your time.

What license is this toolbox under?

Hello, I apologise if creating an issue to ask this question was the wrong way to go about things, but I could not find an e-mail address to send my question to.
Firstly, thanks for a great toolbox.
I'm just wondering what everything is licensed under, if licensed at all, since I wish to use it in another project.

Thanks,
Kim

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.