Edit details of an image.
161719
def cli(env, identifier, name, note, tag):
    """"""

    image_mgr = SoftLayer.ImageManager(env.client)
    data = {}
    if name:
        data['name'] = name
    if note:
        data['note'] = note
    if tag:
        data['tag'] = tag
    image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image')
    if not image_mgr.edit(image_id, **data):
        raise exceptions.CLIAbort("Failed to Edit Image")
504010
def set_image(self):
        """"""

        if not self.image:
            scrape_image(self)

        # If still no image then use first contributor image
        if not self.image:
            contributors = self.get_primary_contributors()
            if contributors:
                self.image = contributors[0].image
                self.save(set_image=False)

        # If still not image then default
        if not self.image:
            filename = settings.STATIC_ROOT + 'music/images/default.png'
            if os.path.exists(filename):
                image = File(
                    open(filename, 'rb')
                )
                image.name = 'default.png'
                self.image = image
                self.save(set_image=False)
469609
def post_process(self):
        
        self.image.putdata(self.pixels)
        self.image = self.image.transpose(Image.ROTATE_90)
1363239
def put_image_layer(self, image_id, data):
        """"""
        return self._http_call(self.IMAGE_JSON, put,
                               data=data, image_id=image_id)
1166988
def preprocess(img):
    """"""
    # Crop the image.
    img = img[35:195]
    # Downsample by factor of 2.
    img = img[::2, ::2, 0]
    # Erase background (background type 1).
    img[img == 144] = 0
    # Erase background (background type 2).
    img[img == 109] = 0
    # Set everything else (paddles, ball) to 1.
    img[img != 0] = 1
    return img.astype(np.float).ravel()
254610
def interpolation_change_cb(self, setting, value):
        """"""
        canvas_img = self.get_canvas_image()
        canvas_img.interpolation = value
        canvas_img.reset_optimize()
        self.redraw(whence=0)
346320
def edit_imagefindpars():
    
    teal.teal(imagefindpars.__taskname__, returnAs=None,
              autoClose=True, loadOnly=False, canExecute=False)
380770
def add_image_description(self, dict):
        """"""
        if self._ef is not None:
            self._ef['0th'][piexif.ImageIFD.ImageDescription] = json.dumps(
                dict)
411938
def set_image(self, user, image_path):
        """"""
        _, ext = os.path.splitext(image_path)
        shutil.copy(image_path, self._custom_image_path(user, ext))
1017824
def set_custom_image(user_context, app_id, image_path):
  """"""
  if image_path is None:
    return False

  if not os.path.exists(image_path):
    return False

  (root, ext) = os.path.splitext(image_path)
  if not is_valid_extension(ext):
    # TODO: Maybe log that this happened?
    return False
  # If we don't remove the old image then theres no guarantee that Steam will
  # show our new image when it launches.
  if has_custom_image(user_context, app_id):
    img = get_custom_image(user_context, app_id)
    assert(img is not None)
    os.remove(img)
  
  # Set the new image
  parent_dir = paths.custom_images_directory(user_context)
  new_path = os.path.join(parent_dir, app_id + ext)
  shutil.copyfile(image_path, new_path)
  return True
267329
def format_image(self, image, image_format, **kwargs):
        """"""

        image_format = image_format.lower()
        accept = self.request.META['HTTP_ACCEPT'].split(',')

        if FORCE_WEBP and 'image/webp' in accept:
            image_format = 'webp'
        elif image_format == 'png8':
            alpha = image.split()[-1]
            image = image.convert('RGB')
            image = image.convert('P', palette=Image.ADAPTIVE, colors=255)
            image.paste(255, Image.eval(alpha, lambda x: 255 if x <= 128 else 0))
            image_format = 'png'
            kwargs['transparency'] = 255
        elif image_format in ('png32', 'png24'):
            image_format = 'png'

        return super(GetImageView, self).format_image(image, image_format, **kwargs)
939859
function generatePatch(image) {

                    var totalPixels = image.pixels.length;
                    var patchData = new Uint8ClampedArray(totalPixels * 4);
                    for (var i = 0; i < totalPixels; i++) {
                        var pos = i * 4;
                        var colorIndex = image.pixels[i];
                        var color = image.colorTable[colorIndex];
                        patchData[pos] = color[0];
                        patchData[pos + 1] = color[1];
                        patchData[pos + 2] = color[2];
                        patchData[pos + 3] = colorIndex !== image.transparentIndex ? 255 : 0;
                    }

                    return patchData;
                }
866314
def clearImg(self):
        """"""
        self.img.setImage(np.array([[0]]))
        self.img.image = None
757077
private function addImageSizes()
    {
        $data = $this->getData();
        foreach ($data as $slug => $props)
        {
            add_image_size($slug, $props['width'], $props['height'], $props['crop']);
        }
    }
569563
def change(img):
    """"""
    if not os.path.isfile(img):
        return

    desktop = get_desktop_env()

    if OS == "Darwin":
        set_mac_wallpaper(img)

    elif OS == "Windows":
        set_win_wallpaper(img)

    else:
        set_desktop_wallpaper(desktop, img)

    logging.info("Set the new wallpaper.")
1020877
private void scaleToOutputResolution(Image image) {

        float factor = m_sharedContext.getDotsPerPixel();
        if (factor != 1.0f) {
            image.scaleAbsolute(image.getPlainWidth() * factor, image.getPlainHeight() * factor);
        }
    }
1155771
def replace(self, photo_file, **kwds):
        
        result = self._client.photo.replace(self, photo_file, **kwds)
        self._replace_fields(result.get_fields())