Discard any changes made to the image and restore the original state
323284
public function restore()
    {
        $this->image = imagecreatetruecolor(imagesx($this->orgImage), imagesy($this->orgImage));
        imagecopy($this->image, $this->orgImage, 0, 0, 0, 0, imagesx($this->orgImage), imagesy($this->orgImage));

        return $this;
    }
549045
def clean(self, value):
        
        path = super(Image, self).clean(value)
        if path and self.size:
            self.resize_image(join(self.base_path, path))
        return path
1156689
def reset(self, old_scene=None, screen=None):
        
        # Always reset all the effects.
        for effect in self._effects:
            effect.reset()

        # If we have an old Scene to recreate, get the data out of that and
        # apply it where possible by cloning objects where appropriate.
        if old_scene:
            for old_effect in old_scene.effects:
                # Using the "easier to ask forgiveness..." mantra, just try
                # cloning everything and ignore any AttributeErrors.
                try:
                    old_effect.clone(screen, self)
                except AttributeError:
                    pass
890715
def redo(self, channel, image):
        """"""
        chname = channel.name
        if image is None:
            # shouldn't happen, but let's play it safe
            return

        imname = image.get('name', 'none')
        iminfo = channel.get_image_info(imname)
        timestamp = iminfo.time_modified

        if timestamp is None:
            reason = iminfo.get('reason_modified', None)
            if reason is not None:
                self.fv.show_error(
                    "{0} invoked 'modified' callback to ChangeHistory with a "
                    "reason but without a timestamp. The plugin invoking the "
                    "callback is no longer be compatible with Ginga. "
                    "Please contact plugin developer to update the plugin "
                    "to use self.fv.update_image_info() like Mosaic "
                    "plugin.".format(imname))

            # Image somehow lost its history
            self.remove_image_info_cb(self.fv, channel, iminfo)
            return

        self.add_entry(chname, iminfo)
1142877
function restore() {
    if (isPrevented) {
        const { body } = document;
        if (previousStyles) {
            body.setAttribute('style', previousStyles);
        } else {
            body.removeAttribute('style');
        }

        window.scrollTo(...previousPosition);
        resizeUtil.removeEventListener('', recalculate);
        isPrevented = false;
    }
}
927300
def cleanup_images(self):
        
        for image in self.list_images():
            if CONU_ARTIFACT_TAG in image.name:
                image.rmi()
        # remove all hidden images -> causes trouble when pulling the image again
        run_cmd(["machinectl", "--no-pager", "clean"])
1242677
def redraw(self, reset_camera=False):
        
        self.ren.RemoveAllViewProps()
        self.picker = None
        self.add_picker_fixed()
        self.helptxt_mapper = vtk.vtkTextMapper()
        tprops = self.helptxt_mapper.GetTextProperty()
        tprops.SetFontSize(14)
        tprops.SetFontFamilyToTimes()
        tprops.SetColor(0, 0, 0)

        if self.structure is not None:
            self.set_structure(self.structure, reset_camera)

        self.ren_win.Render()
1317877
function (image, old) {
        var data1 = old.data,
            data2 = image.data,
            w1 = old.width,
            w2 = image.width,
            px1 = old.globalOffset.x,
            py1 = old.globalOffset.y,
            px2 = image.globalOffset.x,
            py2 = image.globalOffset.y,
            b1 = old.bounds,
            b2 = image.bounds,
            px = Math.min(b1.minX + px1, b2.minX + px2), // global offset for new image (by min in bounds)
            py = Math.min(b1.minY + py1, b2.minY + py2),
            b = { // bounds for new image include all of the pixels [0,0,width,height] (reduce to bounds)
                minX: 0,
                minY: 0,
                maxX: Math.max(b1.maxX + px1, b2.maxX + px2) - px,
                maxY: Math.max(b1.maxY + py1, b2.maxY + py2) - py,
            },
            w = b.maxX + 1, // size for new image
            h = b.maxY + 1,
            i, j, k, k1, k2, len;

        var result = new Uint8Array(w * h);

        // copy all old image
        len = b1.maxX - b1.minX + 1;
        i = (py1 - py + b1.minY) * w + (px1 - px + b1.minX);
        k1 = b1.minY * w1 + b1.minX;
        k2 = b1.maxY * w1 + b1.minX + 1;
        // walk through rows (Y)
        for (k = k1; k < k2; k += w1) {
            result.set(data1.subarray(k, k + len), i); // copy row
            i += w;
        }

        // copy new image (only "black" pixels)
        len = b2.maxX - b2.minX + 1;
        i = (py2 - py + b2.minY) * w + (px2 - px + b2.minX);
        k1 = b2.minY * w2 + b2.minX;
        k2 = b2.maxY * w2 + b2.minX + 1;
        // walk through rows (Y)
        for (k = k1; k < k2; k += w2) {
            // walk through cols (X)
            for (j = 0; j < len; j++) {
                if (data2[k + j] === 1) result[i + j] = 1;
            }
            i += w;
        }

        return {
            data: result,
            width: w,
            height: h,
            bounds: b,
            globalOffset: {
                x: px,
                y: py,
            }
        };
    }
459893
public void cleanup(boolean reuse, boolean wasInsert)
    {
        if(currentImage != null)
        {
            performImageCleanup(currentImage, reuse);
        }
        if(beforeImage != null)
        {
            // we always free all resources of the old image
            performImageCleanup(beforeImage, false);
        }
        if(reuse)
        {
            refreshObjectImage(wasInsert);
        }
        else
        {
            myObj = null;
        }
    }
1132908
public function reset() {
        if ($this->transformations) {
            // Remove image transformations
            $this->transformations = array();
            $this->query->remove('t');
        }

        if ($this->extension) {
            // Remove the extension
            $this->path = str_replace('.' . $this->extension, '', $this->path);
            $this->extension = null;
        }

        return $this;
    }
1081299
def redo(self):
        
        if self.use_slit:
            image = self.fitsimage.get_image()
            if image != self.cuts_image:
                self.cuts_image = image
                self.build_axes()

        self.replot_all()
813590
def reset(self):
        '''
        
        '''
        self._current_index = -1
        self._current_value = self._default_value
        self._current_rendered = self._default_rendered
        self.offset = None
474252
def _replace_old_image(self):
        ''' 
        '''
        try:
            old_obj = self.__class__.objects.get(pk=self.pk)
            if old_obj.image.path != self.image.path:
                path = old_obj.image.path
                default_storage.delete(path)
        except self.__class__.DoesNotExist:
            pass
394104
def cleanup(self):
        """"""
        t = time.time()
        for noncefile in glob(self.path + '/*.nonce'):
            if os.path.getmtime(noncefile) + self.expiration > t:
                os.unlink(noncefile)
1337127
def revert(self):
        """"""
        index = self.get_stack_index()
        finfo = self.data[index]
        filename = finfo.filename
        if finfo.editor.document().isModified():
            self.msgbox = QMessageBox(
                    QMessageBox.Warning,
                    self.title,
                    _("All changes to <b>%s</b> will be lost."
                      "<br>Do you want to revert file from disk?"
                      ) % osp.basename(filename),
                    QMessageBox.Yes | QMessageBox.No,
                    self)
            answer = self.msgbox.exec_()
            if answer != QMessageBox.Yes:
                return
        self.reload(index)
97657
def revert(self, strip=0, root=None):
    
    reverted = copy.deepcopy(self)
    reverted._reverse()
    return reverted.apply(strip, root)
963702
def reset():
    
    shutil.rmtree(session['img_input_dir'])
    shutil.rmtree(session['img_output_dir'])
    session.clear()
    return jsonify(ok='true')