question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

process() access image dimension information after resizing

See original GitHub issue

My goal in using filepond was simply to get uploaded images into some reasonably scaled state via compression and resizing before uploading to an s3 transfer accelerated bucket and transferring to their final destination (when they’re queued for additional processing, etc). All is working here for us except that I can’t seem to determine where on earth the finished file dimensions are after combing through the documentation.

I am uploading an image using my own “process” function and noticed that the metadata argument has incorrect values for width and height given these settings which leads me to believe metadata is actually just information about my settings that I already know given:

imageResizeTargetWidth=1920 imageResizeUpscale=false imageResizeMode=contain

We expected to see the resulting width and height in the metadata object. Given an jpeg that measures 5184x3456 here is the metadata object as passed to my process() function as instructed:

process(fieldName, file, metadata, load, error, progress, abort, transfer, options) { ... }
{
  "resize": {
    "mode": "contain",
    "upscale": false,
    "size": {
      "width": 1920,
      "height": 1920
    }
  },
  "color": null,
  "output": {
    "type": null,
    "quality": null,
    "client": [
      "crop",
      "resize",
      "filter",
      "markup",
      "output"
    ]
  }
}

Expected metadata.resize.size.height to equal it’s processed which in this case is 1280.

Versions:

    {"filepond": "^4.20.1",
    "filepond-plugin-file-validate-type": "^1.2.5",
    "filepond-plugin-image-preview": "^4.6.4",
    "filepond-plugin-image-resize": "^2.0.7",
    "filepond-plugin-image-transform": "^3.7.4"}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
tvbcommented, Nov 6, 2020

Gotcha! Thanks, I like Doka and will probably get a license at some point in time, but until then I will stick with my current code. Or change it if you decide to make a plugin for it!

2reactions
tvbcommented, Nov 4, 2020

@rikschennink can you make the uploaded image dimensions accessible in the file object? https://pqina.nl/filepond/docs/patterns/api/file/

The use case here is we want to put the uploaded image onto another <img> element and set it’s dimension to the uploaded image.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image Processing in Python with Pillow - Auth0
Learn how to process images using the Pillow Python library. ... The resize() method returns an image whose width and height exactly match ......
Read more >
Image Resizing in Python | Pillow, Open CV and ImageKit
Resizing images can be done by cv2.resize() method. import cv2 img = cv2.imread('sunset.jpg') # Get original height and width print(f"Original ...
Read more >
Image Resizing Techniques - NSHipster
By simply resizing that image to the size of the image view before ... Finally, the makeImage() method captures the information from the ......
Read more >
How To Process Images in Node.js With Sharp - DigitalOcean
First, you'll chain the resize() method from the sharp instance to resize the image, and save it in the project directory. Second, you'll...
Read more >
Resizing Images with Amazon CloudFront & Lambda@Edge
Invoke resize operation only if the required dimension/format does not exist. Let's also assume your viewer is based in Mumbai and your origin ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found