Remix.run Logo
vic1102 a day ago

I ran into the same issue when working with image processing in Go using libvips. By default, libvips ignores EXIF orientation too, so I had to explicitly read and apply the orientation tag before doing any resize or crop. Otherwise users ended up with upside-down processed images from photos. Glad to see this is getting better in Rust.

jcupitt 19 hours ago | parent [-]

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 6 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!