Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add relation of tile after cropImageToTiles #313

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions imagick/magick_wand_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,19 +475,19 @@ func (mw *MagickWand) CropImageToTiles(cropGeom string) error {

defer C.MagickDestroyImage(newImg)

newWand := NewMagickWandFromImage(&Image{newImg})
defer newWand.Destroy()

if err := mw.AddImage(newWand); err != nil {
return fmt.Errorf("error replacing image: %v", err)
}

mw.PreviousImage()

if err := mw.RemoveImage(); err != nil {
return fmt.Errorf("error removing current image: %v", err)
}

for next := newImg; next != nil; next = C.GetNextImageInList(next) {
tempWand := NewMagickWandFromImage(&Image{next})
if err := mw.AddImage(tempWand); err != nil {
return fmt.Errorf("error replacing image: %v", err)
}
tempWand.Destroy()
}
mw.SetFirstIterator()
justinfx marked this conversation as resolved.
Show resolved Hide resolved

runtime.KeepAlive(mw)
runtime.KeepAlive(img)

Expand Down
Loading