Skip to main content

How to Check Image Orientation in NodeJs?

In this article, we will explore different approaches to checking the orientation of an image file in Node.js. Specifically, we will compare two popular libraries, "sharp" and "image-size".


To check if an image file is vertical or horizontal in Node.js, you can utilize the `sharp` package, which is a popular image processing library. Here's an example of how you can determine the orientation of an image file using `sharp`:

First, you need to install the `sharp` package by running the following command in your Node.js project directory: