Loads an image and returns when a frame is done, the image is done, an error occurs, or the image is aborted.
542720
public void loadImage() throws InterruptedException {
		synchronized(this) {
			status=0;
			image.getSource().startProduction(this);
			while((status&(IMAGEABORTED|IMAGEERROR|SINGLEFRAMEDONE|STATICIMAGEDONE))==0) {
				wait();
			}
		}
	}
1352449
def load_image(canvas, filepath, bounds=None):
    """"""

    image_data = Image.open(filepath)
    if bounds:
        image_data.thumbnail(bounds, PIL.Image.ANTIALIAS)
    canvas.image = ImageTk.PhotoImage(image_data)
    canvas.create_image(0, 0, image=canvas.image, anchor=tk.NW)
1364068
def _get_image_or_404(identifier, load_image=False):
    
    try:
        image_id = int(identifier)
    except ValueError:
        raise Http404()

    ik_image = get_object_or_404(ICEkitImage, id=image_id)
    if not load_image:
        return ik_image, None

    ####################################################################
    # Image-loading incantation cribbed from easythumbnail's `pil_image`
    image = Image.open(BytesIO(ik_image.image.read()))
    # Fully load the image now to catch any problems with the image contents.
    try:
        # An "Image file truncated" exception can occur for some images that
        # are still mostly valid -- we'll swallow the exception.
        image.load()
    except IOError:
        pass
    # Try a second time to catch any other potential exceptions.
    image.load()
    if True:  # Support EXIF orientation data
        image = et_utils.exif_orientation(image)
    ####################################################################

    return ik_image, image
447877
def load_image(self, file_path, redraw=True):
        

        if not os.path.exists(file_path):
            raise IOError('%s not found' % file_path)

        img = Image.open(file_path).convert('RGB')
        pixel_list = list(map(list, img.getdata()))

        if redraw:
            self.set_pixels(pixel_list)

        return pixel_list
976924
def load_tk_image(filename):
    

    if filename is None:
        return None

    if not os.path.isfile(filename):
        raise ValueError('Image file {} does not exist.'.format(filename))

    tk_image = None

    filename = os.path.normpath(filename)
    _, ext = os.path.splitext(filename)

    try:
        pil_image = PILImage.open(filename)
        tk_image = PILImageTk.PhotoImage(pil_image)
    except:
        try:
            # Fallback if PIL isn't available
            tk_image = tk.PhotoImage(file=filename)
        except:
            msg = "Cannot load {}.  Check to make sure it is an image file.".format(filename)
            try:
                _ = PILImage
            except:
                msg += "\nPIL library isn't installed.  If it isn't installed, only .gif files can be used."
            raise ValueError(msg)
    return tk_image
1131791
function loadImageForBreakpoint(image, s) {
  var alreadyLoaded = image.loadedSizes[s];

  if ('undefined' !== typeof alreadyLoaded) {
    setImage(image, alreadyLoaded);
  } else {
    var img = new Image();

    img.onload = function() {
      image.loadedSizes[s] = img;
      setImage(image, img);
      update(image);

      image.hasRunOnce = true;
    };

    // If requesting retina fails
    img.onerror = function() {
      if (image.hasRetina && !image.hasLoadedFallback) {
        image.hasLoadedFallback = true;
        var path = image.getPath(image, s, false);
        if (path) {
          img.src = path;
        }
      } else {
        image.trigger('error', img);
      }
    };
    
    var path = image.getPath(image, s, image.hasRetina);

    if (path) {
      img.src = path;
    }
  }
}
726351
function nextFrame() {
		if (currentVideo.paused || currentVideo.ended) {
			return;
		}
		context.drawImage(currentVideo, 0, 0);
		requestAnimationFrame(nextFrame);
	}
403736
function loadImage (file, callback, options) {
    var img = document.createElement('img')
    var url
    img.onerror = function (event) {
      return loadImage.onerror(img, event, file, callback, options)
    }
    img.onload = function (event) {
      return loadImage.onload(img, event, file, callback, options)
    }
    if (typeof file === 'string') {
      loadImage.fetchBlob(
        file,
        function (blob) {
          if (blob) {
            file = blob
            url = loadImage.createObjectURL(file)
          } else {
            url = file
            if (options && options.crossOrigin) {
              img.crossOrigin = options.crossOrigin
            }
          }
          img.src = url
        },
        options
      )
      return img
    } else if (
      loadImage.isInstanceOf('Blob', file) ||
      // Files are also Blob instances, but some browsers
      // (Firefox 3.6) support the File API but not Blobs:
      loadImage.isInstanceOf('File', file)
    ) {
      url = img._objectURL = loadImage.createObjectURL(file)
      if (url) {
        img.src = url
        return img
      }
      return loadImage.readFile(file, function (e) {
        var target = e.target
        if (target && target.result) {
          img.src = target.result
        } else if (callback) {
          callback(e)
        }
      })
    }
  }
403139
def load(self, draw_bbox = False, **kwargs):
        '''  '''
        im = Image.new('RGBA', self.img_size)
        draw = None
        if draw_bbox:
            draw = ImageDraw.Draw(im)

        for sprite in self.images:
            data = sprite.load()
            sprite_im = Image.open(BytesIO(data))

            size = sprite.imgrect
            im.paste(sprite_im, (size[0], size[2]))
            if draw_bbox:
                draw.rectangle((size[0], size[2], size[1], size[3]), outline='red')

        del draw
        b = BytesIO()
        im.save(b, format = 'PNG')
        return b.getvalue()
1044329
private S waitForCompletionAndThrowIfUploadFailed() throws IOException {
    try {
      return uploadOperation.get();
    } catch (InterruptedException e) {
      // If we were interrupted, we need to cancel the upload operation.
      uploadOperation.cancel(true);
      IOException exception = new ClosedByInterruptException();
      exception.addSuppressed(e);
      throw exception;
    } catch (ExecutionException e) {
      if (e.getCause() instanceof Error) {
        throw (Error) e.getCause();
      }
      throw new IOException("Upload failed", e.getCause());
    }
  }
522145
def _process_image_file(fobj, session, filename):
  """"""
  # We need to read the image files and convert them to JPEG, since some files
  # actually contain GIF, PNG or BMP data (despite having a .jpg extension) and
  # some encoding options that will make TF crash in general.
  image = _decode_image(fobj, session, filename=filename)
  return _encode_jpeg(image)
584979
def processed_image(image, options = {})
      size = options[:size]
      upsample = !!options[:upsample]

      return image unless size.present? && has_convertible_format?

      if options[:crop]
        crop(size, options[:crop_from], options[:crop_size], upsample)
      else
        resize(size, upsample)
      end
    end
1230829
@Override
	public void processImage(int sourceID, long frameID, final BufferedImage buffered, ImageBase input) {
		System.out.flush();

		synchronized (bufferedImageLock) {
			original = ConvertBufferedImage.checkCopy(buffered, original);
			work = ConvertBufferedImage.checkDeclare(buffered, work);
		}

		if( saveRequested ) {
			saveInputImage();
			saveRequested = false;
		}

		final double timeInSeconds;

		// TODO Copy all data that's visualized outside so that GUI doesn't lock
		synchronized (this) {
			long before = System.nanoTime();
			detector.process((T)input);
			long after = System.nanoTime();
			timeInSeconds = (after-before)*1e-9;
		}

		// create a local copy so that gui and processing thread's dont conflict
		synchronized (detected) {
			this.detected.reset();
			for (QrCode d : detector.getDetections()) {
				this.detected.grow().set(d);
			}
			this.failures.reset();
			for (QrCode d : detector.getFailures()) {
				if( d.failureCause.ordinal() >= QrCode.Failure.READING_BITS.ordinal())
					this.failures.grow().set(d);
			}
//			System.out.println("Failed "+failures.size());
//			for( QrCode qr : failures.toList() ) {
//				System.out.println("  cause "+qr.failureCause);
//			}
		}
		controlPanel.polygonPanel.thresholdPanel.updateHistogram((T)input);


		SwingUtilities.invokeLater(() -> {
			controls.setProcessingTimeS(timeInSeconds);
			viewUpdated();
			synchronized (detected) {
				controlPanel.messagePanel.updateList(detected.toList(),failures.toList());
			}
		});
	}
859335
function checkIsImage (src, onResult) {
  var request;

  if (src.tagName) {
    onResult(src.tagName === 'IMG');
    return;
  }
  request = new XMLHttpRequest();

  // Try to send HEAD request to check if image first.
  request.open('HEAD', src);
  request.addEventListener('load', function (event) {
    var contentType;
    if (request.status >= 200 && request.status < 300) {
      contentType = request.getResponseHeader('Content-Type');
      if (contentType == null) {
        checkIsImageFallback(src, onResult);
      } else {
        if (contentType.startsWith('image')) {
          onResult(true);
        } else {
          onResult(false);
        }
      }
    } else {
      checkIsImageFallback(src, onResult);
    }
    request.abort();
  });
  request.send();
}
1346537
public BufferedImage getBufferedImage()
    {
        if (image == null || abort)
            return null;
        
        // no container that would repaint -- wait for the complete image
        if (container == null)
            waitForLoad();
        
        BufferedImage img = new BufferedImage(getIntrinsicWidth(), getIntrinsicHeight(), BufferedImage.TYPE_INT_ARGB);
        Graphics2D g = img.createGraphics();
        g.drawImage(image, null, null);
        g.dispose();

        return img;
    }
1034038
public void process( BufferedImage image ) {
		T input = ConvertBufferedImage.convertFromSingle(image, null, imageType);
		pyramid.process(input);

		DiscretePyramidPanel gui = new DiscretePyramidPanel();
		gui.setPyramid(pyramid);
		gui.render();

		ShowImages.showWindow(gui,"Image Pyramid");

		// To get an image at any of the scales simply call this get function
		T imageAtScale = pyramid.getLayer(1);

		ShowImages.showWindow(ConvertBufferedImage.convertTo(imageAtScale,null,true),"Image at layer 1");
	}
1036818
def image_load(filename: str) -> tcod.image.Image:
    
    return tcod.image.Image._from_cdata(
        ffi.gc(lib.TCOD_image_load(_bytes(filename)), lib.TCOD_image_delete)
    )