Introducing CropScore: An Image Cropper for Content Creators ✂✨
Tags: webdev, design, productivity, netlify
Published: 2022-02-24 08:25:32

---
title: Introducing CropScore: An Image Cropper for Content Creators ✂✨
published: true
description: 
tags: webdev, design, productivity, netlify
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m7nuq3vm2mw6x9v5nr1w.png
canonical_url: https://madza.hashnode.dev/introducing-cropscore-an-image-cropper-for-content-creators
---
If you are a content creator, the chances are you have come across stretched, shrank, non-centered or pixelated images after the posting of your material. Those are mostly caused due to uploading images with a low resolution or inappropriate aspect ratio. 

Visual material gets the most attention and is one of the main criteria that creates the professional impression about your work, therefore it is especially important to get right. Nothing can be worse than a well-written blog with a poorly formatted cover image, for example.

![Hashnode cover](https://cdn.hashnode.com/res/hashnode/image/upload/v1645349265645/8U5vIUw0H.png)

During this month I came up with a solution, that allows you to forget about all the technical issues with resolutions and aspect ratios. In this article, we will review it.

![Preview](https://cdn.hashnode.com/res/hashnode/image/upload/v1645345624422/7DEQDUHeVd.png)

> 💻 The project is live at: [cropper.madza.dev](https://cropper.madza.dev)

> 💾 The code is available at: [GitHub repo](https://github.com/madzadev/cropper)

This project was built specifically as an entry for the [Hashnode](https://hashnode.com) and [Netlify](https://netlify.com) hackathon. It was an awesome experience since the participation motivated me and I came up with a product that could hopefully benefit others as well.

### How do resolutions and aspect ratios relate? 👀

I'm sure you already know the definition for both of them:

- Image resolution describes the image size as the number of pixels it contains. It is expressed by width versus height, such as "1920x1080".

- The aspect ratio of an image is the proportions of its width to its height, and is expressed with two numbers separated by a colon, such as "16:9".

If the resolution is known, you can calculate the aspect ratio. Another way around, if the aspect ratio is known you can scale up the image up and down till it reaches a certain resolution.

### The headaches for content creators 🤯

The recommended resolution for uploads is often hidden. Sometimes the sites include a note below the upload button, but still, for the custom resolutions, we have to find the right aspect ratio first and then use 3rd party tools to scale it up or down.

![Hashnode upload image](https://cdn.hashnode.com/res/hashnode/image/upload/v1645282962772/JZknQTfbB.png)

Some sites try to solve this by using the crop tools on the upload step, but even if they do, you might still end up getting a pixelated image after upload since only the correct aspect ratio is set and no information about the recommended resolution is provided.

![Twitter cropper](https://cdn.hashnode.com/res/hashnode/image/upload/v1645348014658/6Imhvp3-X.gif)

On top of all that, different sites might use different image processing techniques. If the uploaded image does not provide the required aspect ratio, it might get positioned to fit the width or height of the parent container.

![DEV cover](https://cdn.hashnode.com/res/hashnode/image/upload/v1645351437281/Niszv15zLM.png)

Manually using browser dev tools to inspect image resolutions, calculating their ratios, and using external tools like [GIMP](https://www.gimp.org/) or [Photoshop](https://www.adobe.com/products/photoshop.html) to crop images would not be the most efficient way to go. Creating dozens of resolution templates in [Canva](https://canva.com) would probably not be the best solution, also.

We should focus on content creation itself. Resolutions and aspect ratios should be the last things we worry about. That's why I created [CropScore](https://cropper.madza.dev).

### How does CropScore work? ✨

[CropScore](https://cropper.madza.dev) calculates the score (since the name) of how well the real-time crop will fit for the target use. All you have to do is drag and see the magic.

![GIF drag).gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1645312730176/ORhWd_aw6.gif)

The app provides commonly used image presets from some of the most popular sites associated with content creation. Once the preset is selected, the correct aspect ratio is locked in, and the resolution can be further changed depending on the score.

![GIF presets](https://cdn.hashnode.com/res/hashnode/image/upload/v1645342159851/nGPhUJ9Qk.gif)

### The CropScore component ⚛️

When the user drags the crop window, the [CropScore](https://cropper.madza.dev) gives the user a fit score, that describes the level of the match between the crop window and target use in the percentages.

![GIF score](https://cdn.hashnode.com/res/hashnode/image/upload/v1645343463860/jfzTfgCJKq.gif)

For example, if the recommended resolution to upload (provided by the target site) is 1600x840 and your current crop window size in the app is 800x420, then the crop score will be 50.

Obviously, you are aiming for 100, although near values should work as well since sites mostly display the actual image in lower resolution.

Recommended resolution is often set higher since it allows making layout changes that might require displaying images in higher resolution in the future. 

### What about custom sizes?🗜️

With [CropScore](https://cropper.madza.dev) you are not limited to just predefined values for common image types. In fact, the sky is the limit once you need some customization options beyond that.

In the Custom panel, the users are allowed to draw any crop window sizes they want. The crop window is flexible in both the X and Y-axis.

![Custom mode](https://cdn.hashnode.com/res/hashnode/image/upload/v1645353109082/CNB1-96C7.gif)

Users are able to enter the specific resolution and aspect ratios. The input validation is provided, so if the user enters configurations that can't be performed on the image, the warning message will be shown.

![GIF warnings](https://cdn.hashnode.com/res/hashnode/image/upload/v1645343734090/qOj5DTJfRo.gif)

Users can also lock in specific resolutions and aspect ratios. This way the drag window will always preserve the width and height proportions the initial drag area had. Just type it in, lock it and then drag it to whatever resolution you want.

![Custom aspect ratios](https://cdn.hashnode.com/res/hashnode/image/upload/v1645356191705/Kn3mK1Bmk.gif)

In the custom mode, the App will calculate the CropScore based on the image width returning the following formats: SD (Standard Definition), HD (High Definition), FHD (Full High Definition), and UHD (Ultra High Definition), since there is no recommended resolution to compare against.

![Resolutions](https://cdn.hashnode.com/res/hashnode/image/upload/v1645628744669/fh5iJDxrP.gif)

### Image manipulation 🕹️

Thanks to the UI below the canvas, the user has full control over both the image itself and the crop area that is created on top of it. 

The variety of action buttons provides the functionality to drag, move, zoom, rotate, transform and reset. All of those can be especially useful if a precise crop is required and it can not be performed on the image on the initial load.

![Image controls).gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1645345328179/qPLs5lHoh.gif)

To preserve the maximum flexibility options for the users, the crop window is movable in both the preset and custom modes. The user is able to achieve centered crops thanks to the helper grid system. 

![Image move](https://cdn.hashnode.com/res/hashnode/image/upload/v1645625791557/EeU3YiA1X.gif)

### Downloading the Image 💾

Once you are done with making adjustments, it's time to download the image. 

![Download](https://cdn.hashnode.com/res/hashnode/image/upload/v1645626796814/mJn7nV7kR.gif)

You can choose between JPG and PNG formats. The final image name will have "-cropped" concatenated at the end of the original name, so you can easily know which image is processed via [CropScore](https://cropper.madza.dev).

### Use on any device

Need to get the image cropped on the fly? No problem! All the desktop functionality is fully available on both tablets and mobile as well:

![Tablet](https://cdn.hashnode.com/res/hashnode/image/upload/v1645642847939/io7PKf1SP.gif)

![Mobile](https://cdn.hashnode.com/res/hashnode/image/upload/v1645642860772/nQiKxhEQJ.gif)

### Features list 📋

- Image upload - Supported formats .JPG and .PNG
- Presets - Currently there are 33 presets from 10 commonly used platforms
- Custom mode - User is allowed to switch to custom resolutions
- Ratio lock - User can lock any custom aspect ratio
- Input validation - Informative warning messages for invalid inputs
- Move tools - User can move the image around
- Zoom tools - Zoom the image in or out to get the precise crops
- Rotate tools - Rotate image clockwise or counter-clockwise by 45-degree increments
- Transform image - Swap image on X or Y axis
- Helper grid - Providing help for centering
- Resolution data - Updated in real-time as you resize the crop window
- Crop score - Real-time crop score of the fit for the target use
- Image preview - The user is allowed to preview the crop
- Reset - Reset image and crop windows as they were when the image was uploaded
- Download - Download the image in .PNG and .JPG
- Responsive - Use it on any device

### The tech stack I used 🛠️

[NextJS](https://nextjs.org/) - React application framework

[React-cropper](https://www.npmjs.com/package/react-cropper) - For core cropper functionality

[Flaticon](https://www.flaticon.com/), [React-icons](https://react-icons.github.io/react-icons/) - For the icons

[Chakra UI](https://chakra-ui.com/) - For the components

[GitHub](https:/github.com) - To host the code

[Netlify](https://netlify.com) - To deploy the project

[ESLint](https://eslint.org/), [prettier](https://prettier.io/) - For linting and code formatting

[Namecheap](https://www.namecheap.com/) - For custom subdomain (configured on Netlify)

### Who would benefit from CropScore? 👍

[CropScore](https://cropper.madza.dev) was designed keeping the content creators as the main target audience in mind. It should be especially useful for those who cross-post the content across different platforms.

Though, thanks to its customization options, it can be efficiently used by others, too.

### Future plans to improve 🔮

Currently the supported platforms are [Hashnode](https://hashnode.com), [DEV](https://dev.to), [Medium](https://medium.com), [Hackernoon](https://hackernoon.com), [Twitter](https://twitter.com), [LinkedIn](https://linkedin.com), [YouTube](https://youtube.com), [Pinterest](https://pinterest.com), [Facebook](https://facebook.com) and [Instagram](https://instagram.com). In the future I might add other sites recommended by the users.

My aim is to track the future layout changes of the sites, that might affect the use of image resolutions and aspect ratios, as well as add the newly introduced media types. 

### Final notes 🙌

[CropScore](https://cropper.madza.dev) is an open-source project and the code is available on the [GitHub repository](https://cropper.madza.dev).  The feature requests are welcome. The project is under the terms of [MIT license](https://choosealicense.com/licenses/mit/).

I'm glad I had a chance to create a utility that [Hashnode](https://hashnode.com) community can benefit from as well. Customization opinions for users are among their main priorities, and as a result, there are more different image types to upload.

Also, thanks to [Netlify](https://netlify.com) for this opportunity! Before this Hackathon, I had already hosted [multiple projects](https://madza.hashnode.dev/8-projects-to-build-to-master-your-front-end-skills) there and would recommend it for anyone looking for an easy to configure and effective solution for deploying their apps.

<hr>

Building projects have always been my passion and it gives me pleasure to help and inspire people. If you have any questions, feel free to reach out!

Connect me on [Twitter](https://twitter.com/madzadev), [LinkedIn](https://www.linkedin.com/in/madzadev/) and [GitHub](https://github.com/madzadev)!

Visit my [Portfolio](https://madza.dev/code) for more projects like this!