Implements the 'image' snippet
435667
public function image($image, $width=null, $height=null, $alt=null, $class=null, $link=null, $caption=null, $srcset=null) {
		$image = $this->getLink($image);
		$attributes = $this->getHtmlAttributes(array(
			'width'=>$width,
			'height'=>$height,
			'alt'=>$alt,
			'caption'=>$caption,
			'class'=>$class,
			'srcset'=>$srcset
		));

		$img = "<img src='$image'$attributes />";
		if (!is_null($link)) {
			$link = $this->getLink($link);
			return "<a href='$link'>$img</a>";
		}

		return $img;
	}
864345
def bind
      mark_bind
      bind=self.binds
      mark=self
      begin
        binds.image = mark._image
      end while(!binds.image and (mark==mark.proto))
    end
77419
def encode_example(self, image_or_path_or_fobj):
    """"""
    if isinstance(image_or_path_or_fobj, np.ndarray):
      encoded_image = self._encode_image(image_or_path_or_fobj)
    elif isinstance(image_or_path_or_fobj, six.string_types):
      with tf.io.gfile.GFile(image_or_path_or_fobj, 'rb') as image_f:
        encoded_image = image_f.read()
    else:
      encoded_image = image_or_path_or_fobj.read()
    return encoded_image
310388
def _add_image_part(self, image):
        
        partname = self._next_image_partname(image.ext)
        image_part = ImagePart.from_image(image, partname)
        self.append(image_part)
        return image_part
503015
function insertImage(map) {
    let src = map.selectNode().image.src;

    if (src === "") {
        let value = prompt("Please enter your name", "example/img/material-icons/add.svg");

        if (value) {
            map.updateNode("imageSrc", value);
        }
    } else {
        map.updateNode("imageSrc", "");
    }
}
384597
def insert(index, *args)
      args.each { |image| is_an_image image }
      current = get_current
      @images.insert(index, *args)
      set_current current
      self
    end
34210
def latex2png(snippet, outfile):
    """"""
    pngimage = os.path.join(IMAGEDIR, outfile + '.png')
    environment = os.environ
    environment['openout_any'] = 'a'
    environment['shell_escape_commands'] = \
        "bibtex,bibtex8,kpsewhich,makeindex,mpost,repstopdf,gregorio"
    proc = Popen(
        ["lualatex", '-output-directory=' + IMAGEDIR],
        stdin=PIPE,
        stdout=DEVNULL,
        env=environment
    )
    proc.stdin.write(
        (
            LATEX_DOC % (snippet)
        ).encode("utf-8")
    )
    proc.communicate()
    proc.stdin.close()
    call(["pdfcrop", os.path.join(IMAGEDIR, "texput.pdf")], stdout=DEVNULL)
    call(
        [
            "gs",
            "-sDEVICE=pngalpha",
            "-r144",
            "-sOutputFile=" + pngimage,
            os.path.join(IMAGEDIR, "texput-crop.pdf"),
        ],
        stdout=DEVNULL,
    )
630185
def image(node):
    
    o = nodes.image(uri=node.destination)
    if node.first_child is not None:
        o['alt'] = node.first_child.literal
    return o
355426
def process_draw_image( element, output_node )
      pic_name = element.attribute("#{@xlink_ns}:href").value
      if (@image_dir != nil) then
        img = emit_element( output_node, "img" )
        img.attributes["alt"] = pic_name

        # Get rid of everything before the last / in the filename
        base_name = pic_name;
        if ((pos = base_name.rindex('/')) != nil) then
          base_name = base_name[pos + 1 .. -1]
        end
        copy_image_file( pic_name, @image_dir, base_name )
        img.attributes["src"] = "#{@image_dir}/#{base_name}"
        width = element.parent.attribute("#{@svg_ns}:width")
        height= element.parent.attribute("#{@svg_ns}:height")
        if (width != nil && height != nil) then
          img.attributes["style"] = "width:#{width.value}; " +
            "height:#{height.value}"
        end
      else
        div = emit_element( output_node, "div" )
        div.add_text( pic_name )
      end
    end
831556
def image(id, options={})
      params = options
      get(surl('image') + id, params).body
    end
1224561
def process_image(self, decorator):
        
        savefig_dir = self.savefig_dir
        source_dir = self.source_dir
        saveargs = decorator.split(' ')
        filename = saveargs[1]
        # insert relative path to image file in source
        outfile = os.path.relpath(os.path.join(savefig_dir,filename),
                    source_dir)

        imagerows = ['.. image:: %s'%outfile]

        for kwarg in saveargs[2:]:
            arg, val = kwarg.split('=')
            arg = arg.strip()
            val = val.strip()
            imagerows.append('   :%s: %s'%(arg, val))

        image_file = os.path.basename(outfile) # only return file name
        image_directive = '\n'.join(imagerows)
        return image_file, image_directive
605068
def syncImage(img, current, session):
    """"""
    def _img_str(i):
        return "%s - %s" % (i.type, i.description)

    for db_img in current.images:
        img_info = (img.type, img.md5, img.size)
        db_img_info = (db_img.type, db_img.md5, db_img.size)

        if db_img_info == img_info:
            img = None
            break
        elif (db_img.type == img.type and
                db_img.description == img.description):

            if img.md5 != db_img.md5:
                # Update image
                current.images.remove(db_img)
                current.images.append(img)
                session.add(current)
                pout(Fg.green("Updating image") + ": " + _img_str(img))
            img = None
            break

    if img:
        # Add image
        current.images.append(img)
        session.add(current)
        pout(Fg.green("Adding image") + ": " + _img_str(img))
594702
def set_image(self, img):
        ''''''
        self._bmp = wx.BitmapFromImage(img)
        self.SetMinSize((self._bmp.GetWidth(), self._bmp.GetHeight()))
873845
public static Image makeActionImage (Image image, String tip, ClickHandler onClick)
    {
        if (tip != null) {
            image.setTitle(tip);
        }
        return makeActionable(image, onClick, null);
    }
837595
private void inlineImages(Document doc) {
        Elements allImages = doc.getElementsByTag(IMG_TAG);
        for (Element img : allImages) {
            if (img.attr(DATA_INLINE_ATTR).equals("true")) {
                String src = img.attr(IMG_SRC_ATTR);
                try {
                    URL url = new URL(src);
                    URLConnection urlConnection = url.openConnection();
                    urlConnection.connect();
                    String contentType = urlConnection.getContentType();

                    urlConnection.getContent();
                    byte[] srcContent = IOUtils.toByteArray(url.openStream());
                    String base64 = new Base64().encodeToString(srcContent);

                    img.attr(IMG_SRC_ATTR, MessageFormat.format("data:{0};base64,{1}", contentType, base64));
                } catch (Exception e) {
                    LOG.log(Level.WARNING, null, e);
                }
            }
        }
    }
1016368
function image(input) {
        return new Promise(function (valid, invalid) {
            if (input.getAttribute('type') === 'file' && input.getAttribute('accept').indexOf('image') > -1 && _bn_getFile(input) !== false) {
                BunnyFile.getSignature(_bn_getFile(input)).then(function (signature) {
                    if (BunnyFile.isJpeg(signature) || BunnyFile.isPng(signature)) {
                        valid();
                    } else {
                        invalid({ signature: signature });
                    }
                }).catch(function (e) {
                    invalid(e);
                });
            } else {
                valid();
            }
        });
    }
1325164
def renderThumbnail(self, relpath=""):
        """"""
        # no thumbnail -- return empty string
        if self.thumbnail is None:
            return ""
        # else thumbnail is same as full image (because image was small enough), insert directly
        elif self.thumbnail is self.fullimage:
            fname = relpath + self.fullimage
            return """<IMG SRC="%s" ALT="%s"></IMG>""" % (quote_url(fname), quote_url(os.path.basename(self.filename)))
        # else return thumbnail linking to full image
        else:
            tname = relpath + self.thumbnail
            fname = relpath + self.fullimage
            return """<A HREF="%s"><IMG SRC="%s" ALT="%s"></A>""" % (
            quote_url(fname), quote_url(tname), quote_url(os.path.basename(self.filename)))