publiclab / pi-builder

Developing a reproducible build script system for making Raspberry Pi .img files
MIT License
22 stars 15 forks source link

image-sequencer, infragram + web-based RPi Cam software for use with Raspberry Pi camera #42

Closed jywarren closed 6 years ago

jywarren commented 6 years ago

Thanks for opening a pull request! In this repository, opening a PR will initiate the generation of a new Raspberry Pi image, and create an image file you can download and use in your Raspberry Pi.

The changes you add to the pull request, such as adding software to install, will be run on the generated image.

For an example, see the software installed and configured in this pull request: https://github.com/publiclab/image-builder-rpi/pull/15/files

Recipe

Use this space to describe what your "recipe" is intended to install and configure on a Raspberry Pi:


Download instructions

Generating the image will take a few minutes. Once the image is prepared, and if it succeeded, you'll see a green checkmark at the bottom of the pull request. To download the image:

  1. click the green checkmark; you'll go to a page at a URL like https://gitlab.com/publiclab/image-builder-rpi/pipelines/########/builds
  2. On this page, click the Jobs tab, next to Pipeline
  3. Click the green Passed button
  4. Click Download in the right-hand sidebar
  5. Unzip the artifacts.zip file, and also the hypriotos-rpi-camera_web.img.zip within it
  6. Use a program like https://etcher.io/ to flash it to an SD card

You'll also be able to read the output of the image generation in this window.

We hope to create a bot to report back the completed image URL in each pull request. If you can help create such a bot, please contact us at:

https://github.com/publiclab/image-builder-rpi/issues/16

Thanks!

jywarren commented 6 years ago

@maykef here we go! Image sequencer installing here. We have to think through how it'd be used. Would all images taken be auto-processed in Node.js in the background? Or would there be a way to open any image taken in the RPi Cam software but in the Image Sequencer interface for conversion in the browser?

jywarren commented 6 years ago

@tech4gt @Mridul97 check it out -- image sequencer installed on a Raspberry Pi! 😄

jywarren commented 6 years ago

Downloading to test: https://gitlab.com/publiclab/pi-builder/-/jobs/115886766/artifacts/download

jywarren commented 6 years ago

We should make image-sequencer runnable via URL maybe? Could relate to https://github.com/publiclab/image-sequencer/issues/198

jywarren commented 6 years ago

OK, as of this morning, the latest image-sequencer has demo code that can accept a data URL via the demo url hash!

Now we should try modifying https://github.com/silvanmelchior/RPi_Cam_Web_Interface/ and Infragram to make it possible to open an image in the image-sequencer demo. Here's some code to convert an image to a data URL:

function getDataUri(url, callback) {
    var image = new Image();

    image.onload = function () {
        var canvas = document.createElement('canvas');
        canvas.width = this.naturalWidth; // or 'width' if you want a special/scaled size
        canvas.height = this.naturalHeight; // or 'height' if you want a special/scaled size

        canvas.getContext('2d').drawImage(this, 0, 0);

        // Get raw image data
        callback(canvas.toDataURL('image/png').replace(/^data:image\/(png|jpg);base64,/, ''));

        // ... or get as Data URI
        callback(canvas.toDataURL('image/png'));
    };

    image.src = url;
}

// Usage
getDataUri('/logo.png', function(dataUri) {
    // Do whatever you'd like with the Data URI!
});
jywarren commented 6 years ago

This now includes a button in Infragram to open an image in Image Sequencer. https://gitlab.com/publiclab/pi-builder/-/jobs/116657752/artifacts/download

jywarren commented 6 years ago

:-( ok, moving to #50 !