Pick image from gallery
501094
public static Intent pickImage() {
        Intent intent = new Intent(Intent.ACTION_PICK);
        intent.setType("image/*");
        return intent;
    }
540287
def get(img, cache_dir=CACHE_DIR, iterative=False):
    """"""
    if os.path.isfile(img):
        wal_img = img

    elif os.path.isdir(img):
        if iterative:
            wal_img = get_next_image(img)

        else:
            wal_img = get_random_image(img)

    else:
        logging.error("No valid image file found.")
        sys.exit(1)

    wal_img = os.path.abspath(wal_img)

    # Cache the image file path.
    util.save_file(wal_img, os.path.join(cache_dir, "wal"))

    logging.info("Using image \033[1;37m%s\033[0m.", os.path.basename(wal_img))
    return wal_img
641773
def _grab_raw_image(self):
        
        m = self.ale.getScreenRGB()
        return m.reshape((self.height, self.width, 3))
1120011
def get_image(self, path):
        """"""
        image = ''
        name = os.path.basename(path)
        if not StockImage.is_registered(name):
            ipath = self.__find_image(path)
            if ipath is not None:
                StockImage.register(name, ipath)
            else:
                msg = "Image '{0}' not found in resource paths.".format(name)
                logger.warning(msg)
        try:
            image = StockImage.get(name)
        except StockImageException:
            # TODO: notify something here.
            pass
        return image
209607
def get(img, light=False):
    """"""
    cols = gen_colors(img)

    if len(cols) < 6:
        logging.error("colorz failed to generate enough colors.")
        logging.error("Try another backend or another image. (wal --backend)")
        sys.exit(1)

    return adjust(cols, light)
1144716
def get_gallery_file(self, file_id, output_file_path=None, scope='content/read'):
        
        data = _get(
            token=self.oauth.get_user_token(scope),
            uri='/user/media/content/' + urllib.quote(file_id)
        )

        if output_file_path:
            with open(output_file_path, 'w') as f:
                f.write(data)
        else:
            return data
1190149
def remove_from_gallery(self):
        """"""
        url = self._imgur._base_url + "/3/gallery/{0}".format(self.id)
        self._imgur._send_request(url, needs_auth=True, method='DELETE')
        if isinstance(self, Image):
            item = self._imgur.get_image(self.id)
        else:
            item = self._imgur.get_album(self.id)
        _change_object(self, item)
        return self
918065
def show_image(self, key):
        """"""
        data = self.model.get_data()
        data[key].show()
833747
def detect_images_and_galleries(generators):
    """"""
    for generator in generators:
        if isinstance(generator, ArticlesGenerator):
            for article in itertools.chain(generator.articles, generator.translations, generator.drafts):
                detect_image(generator, article)
                detect_gallery(generator, article)
        elif isinstance(generator, PagesGenerator):
            for page in itertools.chain(generator.pages, generator.translations, generator.hidden_pages):
                detect_image(generator, page)
                detect_gallery(generator, page)
797616
def _gather_image_parts(self):
        """"""
        for rel in self.iter_rels():
            if rel.is_external:
                continue
            if rel.reltype != RT.IMAGE:
                continue
            if rel.target_part in self.image_parts:
                continue
            self.image_parts.append(rel.target_part)
894219
def from_array(array):
        
        if array is None or not array:
            return None
        # end if
        assert_type_or_raise(array, dict, parameter_name="array")

        data = {}
        data['total_count'] = int(array.get('total_count'))
        data['photos'] = PhotoSize.from_array_list(array.get('photos'), list_level=2)
        data['_raw'] = array
        return UserProfilePhotos(**data)
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)
1079695
def get_gallery_profile(self):
        """"""
        url = (self._imgur._base_url + "/3/account/{0}/"
               "gallery_profile".format(self.name))
        return self._imgur._send_request(url)
768560
function( isUndo ) {
			var snapshots = this.snapshots,
				currentImage = this.currentImage,
				image, i;

			if ( currentImage ) {
				if ( isUndo ) {
					for ( i = this.index - 1; i >= 0; i-- ) {
						image = snapshots[ i ];
						if ( !currentImage.equalsContent( image ) ) {
							image.index = i;
							return image;
						}
					}
				} else {
					for ( i = this.index + 1; i < snapshots.length; i++ ) {
						image = snapshots[ i ];
						if ( !currentImage.equalsContent( image ) ) {
							image.index = i;
							return image;
						}
					}
				}
			}

			return null;
		}
1242426
def images gallery_template = :default
        if gallery_template == :default
          gallery_template = a.galley!
                              .options.view
        end
        Template[gallery_template].build a
      end
1157587
public function Gallery()
    {
        if ($this->Images()->exists()) {

            // Create a list of images with generated gallery image and thumbnail
            $images = ArrayList::create();
            $pages = $this->PaginatedImages();
            foreach ($this->PaginatedImages() as $image) {
                $image_data = $image->toMap();
                $image_data["GalleryImage"] = $this->GalleryImage($image);
                $image_data["GalleryThumbnail"] = $this->GalleryThumbnail($image);
                $images->add(ArrayData::create($image_data));
            }
            
            $vars = [
                'PaginatedImages' => $pages,
                'Images' => $images,
                'Width' => $this->getFullWidth(),
                'Height' => $this->getFullHeight()
            ];

            return $this->renderWith(
                [
                    'Gallery',
                    'ilateral\SilverStripe\Gallery\Includes\Gallery'
                ],
                $vars
            );
        } else {
            return "";
        }
    }
323453
def get_gallery_item_list(self, folder_name, skip=None, count=None, scope='content/read'):
        

        params = {}
        if skip:
            params['skip'] = skip
        if count:
            params['count'] = count

        qs = '?' + urllib.urlencode(params) if params else ''

        folder_item_list = _get(
            token=self.oauth.get_user_token(scope),
            uri='/user/media/list/' + urllib.quote(folder_name) + qs
        )
        try:
            return json.loads(folder_item_list)
        except:
            raise MxitAPIException('Error parsing gallery folder list')