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

error: heifsave: image too large #425

Open
cruvie opened this issue Apr 20, 2024 · 0 comments
Open

error: heifsave: image too large #425

cruvie opened this issue Apr 20, 2024 · 0 comments

Comments

@cruvie
Copy link

cruvie commented Apr 20, 2024

I try to resize a jpeg(3504 × 19496) image but got error message, here is my code, I cannot find any related param to set, maybe I missed something? anyone can help me? thanks!

func checkError(err error) {
	if err != nil {
		fmt.Println("error:", err)
		os.Exit(1)
	}
}
func TestAvifVips(t *testing.T) {

	workDir, _ := os.Getwd()
	outPath := workDir + "/testjjj.avif"
	//println(outPath)
	out, _ := os.Create(outPath)
	vips.Startup(nil)
	defer vips.Shutdown()

	image1, err := vips.NewImageFromFile("testjjj.jpeg")
	checkError(err)

	// Rotate the picture upright and reset EXIF orientation tag
	err = image1.AutoRotate()
	checkError(err)
	ep := vips.NewAvifExportParams()
	image1bytes, _, err := image1.ExportAvif(ep)
	checkError(err)
	reader := bytes.NewReader(image1bytes)
	io.Copy(out, reader)
	out.Close()
}

here is the log

=== RUN   TestAvifVips
2024/04/21 01:12:44 [VIPS.info] found /opt/homebrew/Cellar/vips/8.15.1_2/lib/vips-modules-8.15
2024/04/21 01:12:44 [VIPS.info] using configure-time prefix
2024/04/21 01:12:44 [VIPS.info] VIPS_PREFIX = /opt/homebrew/Cellar/vips/8.15.1_2
2024/04/21 01:12:44 [VIPS.info] VIPS_LIBDIR = /opt/homebrew/Cellar/vips/8.15.1_2/lib
2024/04/21 01:12:44 [VIPS.info] prefix = /opt/homebrew/Cellar/vips/8.15.1_2
2024/04/21 01:12:44 [VIPS.info] libdir = /opt/homebrew/Cellar/vips/8.15.1_2/lib
2024/04/21 01:12:44 [VIPS.info] searching "/opt/homebrew/Cellar/vips/8.15.1_2/lib/vips-modules-8.15"
2024/04/21 01:12:44 [VIPS.info] loading "/opt/homebrew/Cellar/vips/8.15.1_2/lib/vips-modules-8.15/vips-heif.dylib"
2024/04/21 01:12:44 [VIPS.info] loading "/opt/homebrew/Cellar/vips/8.15.1_2/lib/vips-modules-8.15/vips-magick.dylib"
2024/04/21 01:12:44 [VIPS.info] loading "/opt/homebrew/Cellar/vips/8.15.1_2/lib/vips-modules-8.15/vips-poppler.dylib"
2024/04/21 01:12:44 [VIPS.info] loading "/opt/homebrew/Cellar/vips/8.15.1_2/lib/vips-modules-8.15/vips-openslide.dylib"
2024/04/21 01:12:44 [VIPS.info] loading "/opt/homebrew/Cellar/vips/8.15.1_2/lib/vips-modules-8.15/vips-jxl.dylib"
2024/04/21 01:12:44 [VIPS.info] searching "/opt/homebrew/Cellar/vips/8.15.1_2/lib/vips-plugins-8.15"
2024/04/21 01:12:44 [VIPS.info] im_load_plugins: searching "/opt/homebrew/Cellar/vips/8.15.1_2/lib/vips-8.15"
2024/04/21 01:12:44 [VIPS.info] im_load_plugins: searching "/opt/homebrew/Cellar/vips/8.15.1_2/lib"
2024/04/21 01:12:44 [govips.info] vips 8.15.1 started with concurrency=1 cache_max_files=0 cache_max_mem=52428800 cache_max=100
2024/04/21 01:12:44 [govips.info] registered image type loader type=gif
2024/04/21 01:12:44 [govips.info] registered image type loader type=jpeg
2024/04/21 01:12:44 [govips.info] registered image type loader type=svg
2024/04/21 01:12:44 [govips.info] registered image type loader type=webp
2024/04/21 01:12:44 [govips.info] registered image type loader type=heif
2024/04/21 01:12:44 [govips.info] registered image type loader type=heif
2024/04/21 01:12:44 [govips.info] registered image type loader type=jp2k
2024/04/21 01:12:44 [govips.info] registered image type loader type=magick
2024/04/21 01:12:44 [govips.info] registered image type loader type=pdf
2024/04/21 01:12:44 [govips.info] registered image type loader type=png
2024/04/21 01:12:44 [govips.info] registered image type loader type=tiff
2024/04/21 01:12:44 [govips.info] registered image type loader type=jxl
error: heifsave: image too large

Stack:
goroutine 22 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x64
github.com/davidbyttow/govips/v2/vips.handleVipsError()
	/Users/cruvie/go/pkg/mod/github.com/davidbyttow/govips/v2@v2.14.0/vips/error.go:38 +0x38
github.com/davidbyttow/govips/v2/vips.handleSaveBufferError(0x140003a61c0?)
	/Users/cruvie/go/pkg/mod/github.com/davidbyttow/govips/v2@v2.14.0/vips/error.go:31 +0x28
github.com/davidbyttow/govips/v2/vips.vipsSaveToBuffer({0x12572e920, 0x0, 0xb, 0x0, 0x0, 0x50, 0x0, 0x0, 0x1, 0x0, ...})
	/Users/cruvie/go/pkg/mod/github.com/davidbyttow/govips/v2@v2.14.0/vips/foreign.go:495 +0x98
github.com/davidbyttow/govips/v2/vips.vipsSaveAVIFToBuffer(0x12572e920, {0x0, 0x50, 0x8, 0x5, 0x0, 0x0})
	/Users/cruvie/go/pkg/mod/github.com/davidbyttow/govips/v2@v2.14.0/vips/foreign.go:447 +0x11c
github.com/davidbyttow/govips/v2/vips.(*ImageRef).ExportAvif(0x14000032050, 0x0?)
	/Users/cruvie/go/pkg/mod/github.com/davidbyttow/govips/v2@v2.14.0/vips/image.go:1011 +0x8c
gitee.com/cruvie/kk_go_kit/kk_image/examples.TestAvifVips(0x1400040e820?)
	/Users/cruvie/Nutstore/Coding/Uncomplete-Projects/kk_go_kit/kk_image/examples/resize_test.go:38 +0xdc
testing.tRunner(0x1400040e820, 0x10098a880)
	/usr/local/go/src/testing/testing.go:1689 +0xec
created by testing.(*T).Run in goroutine 1
	/usr/local/go/src/testing/testing.go:1742 +0x318

testjjj

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

1 participant