▲ | jcupitt 19 hours ago | |
Hello, libvips author here, the JPEG loader has a flag to do this for you. You can write: VipsImage *image = vips_image_new_from_file("something.jpg", "autorotate", TRUE, NULL); and it'll flip it upright for you and remove any EXIF orientation tag. It isn't the default since it has (obviously) a large memory and cpu cost. For simple resize and crop it's much better to use the exif tag to adjust the resize and crop parameters (the vipsthumbnail command does this). | ||
▲ | vic1102 7 hours ago | parent [-] | |
Thanks so much for the clarification and for the great work on libvips! In my Go project I’m using the Golang library github.com/davidbyttow/govips/v2. Images are loaded via `vips.NewImageFromFile()`, which internally calls `vips_image_new_from_file()`. However, `NewImageFromFile()` doesn't support any flags or options beyond the image path, so for JPEGs I manually call `AutoRotate()` before resizing, which wraps `vips_autorot()` — and that works well. Thanks again! |