fix(imagorvideo): fix image orientation from video exif (#18)

* fix(imagorvideo): orient image before resize

* test: update golden files

* fix(imagorvideo): orient image before resize

* test: update golden files
This commit is contained in:
Adrian Shum 2022-10-08 11:55:31 +08:00 committed by GitHub
parent 466ff3ec35
commit 145b4ce8a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 11 additions and 11 deletions

View file

@ -131,11 +131,11 @@ func (p *Processor) Process(ctx context.Context, in *imagor.Blob, params imagorp
}
switch meta.Orientation {
case 3:
filters = append(filters, imagorpath.Filter{Name: "rotate", Args: "180"})
filters = append(filters, imagorpath.Filter{Name: "orient", Args: "180"})
case 6:
filters = append(filters, imagorpath.Filter{Name: "rotate", Args: "270"})
filters = append(filters, imagorpath.Filter{Name: "orient", Args: "270"})
case 8:
filters = append(filters, imagorpath.Filter{Name: "rotate", Args: "90"})
filters = append(filters, imagorpath.Filter{Name: "orient", Args: "90"})
}
buf, err := av.Export()
if err != nil || len(buf) == 0 {
@ -151,7 +151,7 @@ func (p *Processor) Process(ctx context.Context, in *imagor.Blob, params imagorp
out = imagor.NewBlobFromMemory(buf, meta.Width, meta.Height, bands)
if len(filters) > 0 {
params.Filters = append(filters, params.Filters...)
params.Filters = append(params.Filters, filters...)
params.Path = imagorpath.GeneratePath(params)
}
err = imagor.ErrForward{Params: params}