Skip to content

Commit

Permalink
directly replace image when calling Replace if it is an image
Browse files Browse the repository at this point in the history
  • Loading branch information
tfriedel6 committed May 10, 2020
1 parent 3a0ca2c commit f36e11b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions images.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ func (img *Image) Delete() {

// Replace replaces the image with the new one
func (img *Image) Replace(src interface{}) error {
if img.src == src {
if origImg, ok := img.src.(image.Image); ok {
img.img.Replace(origImg)
return nil
}
}
newImg, err := img.cv.LoadImage(src)
if err != nil {
return err
Expand Down

0 comments on commit f36e11b

Please sign in to comment.