Open pathouse opened 1 year ago
You can try FailOnError
in vips.ImportParams
, example code:
NumPages: intMinusOne,
is used to make sure GIF images are loaded correctly
package main
import (
"os"
"github.com/davidbyttow/govips/v2/vips"
)
var (
boolFalse vips.BoolParameter
intMinusOne vips.IntParameter
)
func main() {
vips.LoggingSettings(nil, vips.LogLevelError)
vips.Startup(nil)
defer vips.Shutdown()
boolFalse.Set(false)
intMinusOne.Set(-1)
img, err := vips.LoadImageFromFile("invalid.jpg", &vips.ImportParams{
FailOnError: boolFalse,
NumPages: intMinusOne,
})
if err != nil {
panic(err)
}
imageBytes, _, _ := img.ExportWebp(&vips.WebpExportParams{
Quality: 75,
})
_ = os.WriteFile("input_webp.webp", imageBytes, 0644)
}
ah thank you @n0vad3v this did indeed resolve the error when i updated my example repo 👍
i'm running into this error when trying to export a jpeg image
from what i can tell govips has no problem loading the jpeg but then it fails to export that same image
i put together a small example repo here that reproduces the problem: https://github.com/pathouse/jpeg-govips
some searching around the web suggests this is an issue w/ jpegs produced by samsung phones (https://github.com/lovell/sharp/issues/1578) and that the work around may be ignoring this error?
wondering how i can accomplish that in govips
if there's a code change required i'm happy to try to take that on if you're able to point me in the right direction
edit: full stack trace as well