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

[BUG] SetPages method do nothing #375

Open
g-mero opened this issue Jul 30, 2023 · 1 comment
Open

[BUG] SetPages method do nothing #375

g-mero opened this issue Jul 30, 2023 · 1 comment

Comments

@g-mero
Copy link

g-mero commented Jul 30, 2023

// SetPages sets the number of pages in the Image
// For animated images this corresponds to the number of frames

func (r *ImageRef) SetPages(pages int) error {
	out, err := vipsCopyImage(r.image)
	if err != nil {
		return err
	}

	vipsSetImageNPages(r.image, pages)

	r.setImage(out)
	return nil
}

I attempted to use the SetPages method to keep only the first frame of an animated image and export it to a JPEG file, but it doesn't work. After reviewing the code, it appears to merely duplicate the original image.

@songjiayang
Copy link
Contributor

How about setting the page=1 in vips.ImportParams, then just load one page for animated images

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants