Crop image using edit image node

Describe the problem/error/question

Hello,
I’m trying to crop an image I previously download as a binary downloadedImage using a GET request.
The Edit Image node seems to output another binary file downloadedImage with the appropriates dimensions.
But when I try to use the cropped image binary files in other nodes, it uses the uncroped image.

I’ve the same problem if I copy paste my nodes to n8n cloud so it’s not related to my n8n instance.

Here’s a loom video to show you: Arc - Conversion de diapositives - 10 July 2024 | Loom.

What should I try to fix the problem? Thanks.

Please share your workflow

Information on your n8n setup

  • n8n version: 1.44.1
  • Database (default: SQLite):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: macos

Seems like you do not use the correct binary data property. The image does get saved as the binary property downloadedImage, but on the S3 node you have under “Input Binary Field” image set instead. If you change it to downloadedImage it should work as expected.

Hello @jan thanks for helping.

Unfortunately this is not the problem.
The image stored in S3 is still the wrong size.
And as you can see the Get Information node get information about the binary but return wrong image dimensions.

Please see: Arc - Conversion de diapositives - 11 July 2024 | Loom.

Up. I tried to debug this all day - still can’t do it. If someone can comes with a solution would be greatly appreciate! Thanks.

The very first node is not actually returning a 1080x1920 image, but also the 1080x1534 size.

Your original image is 1200x1534. The image crop operation reduces that to 1080x1534 - not to 1080x1920. Try the following workflow, which first resizes to 1080x1920 (whichever is smaller), and THEN crops it.

Also, you can easily check the actual image sizes in Chrome by clicking ‘view’ in the output node, then right-click on the image and select ‘open in new tab’ - the actual size will be the tab title:

image

As a final thought, I have found the image resize/cropping nodes to be rather unpredicatable sometimes, and in some cases it’s better to do the actual math yourself, and crop+position the final result based on the actual image dimensions instead. This will give you much more control over the result.