Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

665
Views
VSCode Extension API: How to obtain the properties of an image file?

I'm creating a VS Code extension and I need to get the properties of image files, only the dimensions/size of the image file using JS(I.e., 1200 × 627). Like the piece of information such as the “Size” that shows in the bottom right corner of the status bar in VS Code when an image file is opened.

I have to do this with either a CDN link of the image, like

https://www.cloudflare.com/static/d2cf82ac895f472c6d208cdccf4e722e/cdn-lc.png or path to the local disk's directory like

I:\Projects\VSCode Extensions\test\New folder\desktop-banner-web.jpg without loading/previewing the image anywhere. Just the retrieval of natural height & width of the image file would suffice for calculations and displaying the result(ratio) to the user. I'm currently getting the URL or the path to the image using Selection (Have to get it without entering the link or path manually) So it could read the image file and provide me with the size/dims, but since VS Code doesn't expose the DOM, I couldn't use JS to find the dimensions, which can be done easily. I tried to get the size/dims using the stat method under FileSystemProvider in the VS Code API Doc but to no avail. Are there any possibilities of achieving this without going over to the Webview?

If someone could provide me with a working code using only JavaScript to get the height & width of any image file in any way of a CDN link or a path, I would greatly appreciate it as I couldn't find anything near this in my research. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!