prevent image rotation (#205)

This commit is contained in:
Vadim 2023-05-20 09:33:25 +03:00 committed by GitHub
parent 227d2bf39d
commit 9138e3d67a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 10 additions and 0 deletions

View File

@ -122,6 +122,11 @@ func avifEncoder(p1, p2 string, quality int, extraParams ExtraParams) error {
return errors.New("AVIF: image too large")
}
err = img.AutoRotate()
if err != nil {
return err
}
// If quality >= 100, we use lossless mode
if quality >= 100 {
buf, _, err = img.ExportAvif(&vips.AvifExportParams{
@ -170,6 +175,11 @@ func webpEncoder(p1, p2 string, quality int, extraParams ExtraParams) error {
return errors.New("WebP: image too large")
}
err = img.AutoRotate()
if err != nil {
return err
}
// If quality >= 100, we use lossless mode
if quality >= 100 {
buf, _, err = img.ExportWebp(&vips.WebpExportParams{

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB