How to use the blueimp-load-image function in blueimp-load-image

To help you get started, we’ve selected a few blueimp-load-image examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github transcranial / keras-js / demos / src / components / common / Imagenet.vue View on Github external
loadImageToCanvas(url) {
      if (!url) {
        this.clearAll()
        return
      }

      this.imageLoading = true
      loadImage(
        url,
        img => {
          if (img.type === 'error') {
            this.imageLoadingError = true
            this.imageLoading = false
          } else {
            // load image data onto input canvas
            const ctx = document.getElementById('input-canvas').getContext('2d')
            ctx.drawImage(img, 0, 0)
            this.imageLoadingError = false
            this.imageLoading = false
            this.modelRunning = true
            // model predict
            this.$nextTick(function() {
              setTimeout(() => {
                this.runModel()
github transcranial / keras-js / demos / src / components / models / ImageSuperResolution.vue View on Github external
loadImageToCanvas(url) {
      if (!url) {
        this.clearAll()
        return
      }

      this.imageLoading = true
      loadImage(
        url,
        img => {
          if (img.type === 'error') {
            this.imageLoadingError = true
            this.imageLoading = false
          } else {
            // adjust canvas dimensions
            const inputCanvas = document.getElementById('input-canvas')
            inputCanvas.width = img.width
            inputCanvas.height = img.height
            this.inputImageShape = [img.height, img.width]
            const outputCanvas = document.getElementById('output-canvas')
            outputCanvas.width = img.width * 2
            outputCanvas.height = img.height * 2
            this.outputImageShape = [img.height * 2, img.width * 2]
            const scaledInputCanvas = document.getElementById('scaled-input-canvas')
github MingwangLin / automatic-manga-colorization / demos / src / components / common / Manga.vue View on Github external
loadImageToCanvas(file) {

                this.imageLoading = true
                loadImage(
                    file,
                    img => {
                        if (img.type === 'error') {
                            this.imageLoadingError = true
                            this.imageLoading = false
                        } else {
                            // adjust canvas dimensions
                            const inputCanvas = document.getElementById('input-canvas')
                            inputCanvas.width = img.width
                            inputCanvas.height = img.width
                            this.inputImageShape = [img.width, img.width]
                            const outputCanvas = document.getElementById('output-canvas')
                            outputCanvas.width = img.width
                            outputCanvas.height = img.width
                            this.outputImageShape = [img.width, img.width]
                            const scaledInputCanvas = document.getElementById('scaled-input-canvas')
github nerdic-coder / block-photos / src / components / block-img.tsx View on Github external
} else if (rotation === 6 && originalOrientation === 8) {
          rotation = 3;
        } else if (rotation === 8 && originalOrientation === 3) {
          rotation = 6;
        } else if (rotation === 6 && originalOrientation === 3) {
          rotation = 8;
        }
      }
    }

    // Set photo orientation from exif
    if (rotate) {
      const imageOptions = {
        orientation: rotation
      };
      loadImage(
        base64,
        processedPhoto => {
          this.handleProcessedPhoto(processedPhoto);
        },
        imageOptions
      );
    } else {
      this.rotation = rotation;
      this.source = base64;
    }
  }
github microsoft / onnxjs-demo / src / components / common / WebcamModelUI.vue View on Github external
loadImageToCanvas(url: string) {
    if (!url) {
      const element = document.getElementById('input-canvas') as HTMLCanvasElement;
      const ctx = element.getContext('2d')as CanvasRenderingContext2D;
      ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
      return;
    }
    loadImage(
        url,
        img => {
        if ((img as Event).type === 'error') {
            this.imageLoadingError = true;
            this.imageLoading = false;
        } else {
            // load image data onto input canvas
            const element = document.getElementById('input-canvas') as HTMLCanvasElement;
            const ctx = element.getContext('2d') as CanvasRenderingContext2D;
            const imageWidth = (img as HTMLImageElement).width;
            const imageHeight = (img as HTMLImageElement).height;
            ctx.drawImage(img as HTMLImageElement, 0, 0, imageWidth, 
              imageHeight, 0, 0, element.width, element.height);
            this.imageLoadingError = false;
            this.imageLoading = false;
            this.sessionRunning = true;
github stamp-web / stamp-web-aurelia / src / resources / elements / image-preview / image-preview.js View on Github external
_.defer(() => {
                let container = $(this.element).parents().find(this.boundsSelector);
                loadImage(  this.fullImage, img => {
                    if(img.type === "error") {
                        this.closeFullSizeImage();
                    } else {
                        $(this.element).find('div').html(img);
                    }
                }, {
                    maxWidth: +container.width(),
                    maxHeight: +container.height(),
                    contain: true
                } );
            });
        } else {
github OriginProtocol / origin / experimental / origin-dapp2 / src / components / ImageCropper.js View on Github external
onSelectFile(e) {
    if (e.target.files && e.target.files.length > 0) {
      loadImage(
        e.target.files[0],
        img => this.setState({ src: img.toDataURL('image/jpeg'), open: true }),
        {
          orientation: true,
          maxWidth: 250,
          maxHeight: 250
        }
      )
    }
  }
github topcoder-platform / community-app / src / shared / components / Settings / Profile / BasicInfo / ImageInput / index.jsx View on Github external
loadImage.parseMetaData(file, (data) => {
      let orientation = 0;
      if (data.exif) {
        orientation = data.exif.get('Orientation');
      }
      loadImage(
        file,
        (img) => {
          img.toBlob(
            (blobResult) => {
              uploadPhoto(handle, tokenV3, blobResult);
            },
          );
        }, {
          canvas: true,
          orientation,
        },
      );
    });
  }
github OriginProtocol / origin / experimental / origin-dapp2 / src / components / ImagePicker.js View on Github external
const newFile = await new Promise(resolve => {
      loadImage(file, img => img.toBlob(blob => resolve(blob), 'image/jpeg'), {
        orientation: true,
        maxWidth: 2000,
        maxHeight: 2000
      })
    })

blueimp-load-image

JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled, cropped or rotated HTML img or canvas element. It also provides methods to parse image metadata to extract IPTC and Exif tags a

MIT
Latest version published 3 years ago

Package Health Score

58 / 100
Full package analysis