Giter VIP home page Giter VIP logo

Comments (4)

dlemstra avatar dlemstra commented on May 17, 2024

You could call .AutoOrient on the image before you resize it. This will rotate the image to the "correct" orientation.

from imagesharp.

tocsoft avatar tocsoft commented on May 17, 2024

@dj-nitehawk I can confirm, based on your test image, that .AutoOrient() is all you need to do to fix your issue.

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 17, 2024

@dlemstra @tocsoft Thanks.. That answer does the trick but...

@dj-nitehawk It's best to also explain why ImageSharp is actually doing the right thing without AutoRotate

ImageSharp is actually correctly resizing those images.

Jpeg files have specific values in something called the Start of Frame marker which defines the width and height of the image. ImageSharp, like any other library (e.g System.Drawing) will read those values to determine the correct dimensions and layout of the byte array to store that image data.

The EXIF metadata contained within the image is additional, unrelated data that is sometimes used to determine how the image is displayed (i.e. rotation).

This data does not determine how the width and height of an image is calculated. Software like Photoshop might (I haven't tested) present the image in a rotated fashion with the dimensions swapped to make it less confusing for the end user but a graphics library will not.

I hope that makes sense

from imagesharp.

dj-nitehawk avatar dj-nitehawk commented on May 17, 2024

thanks guys!

.AutoOrient() does the job perfectly...

appreciate the super-fast support :-)

from imagesharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.