Error trying to get the dimensions of an .jpeg image from a buffer
See original GitHub issueThis constant doesn’t include .jpeg (0x41), and doesn’t want to work with a buffer from a downloaded .jpeg image… Gives the error: unsupported file type: undefined (file: undefined)(...)
. The buffer was a buffer, and not undefined.
I also see it is missing some other file types.
Edit: I thought all JPEG types was supported. Maybe this isn’t a bug. I read in your code that the file has to be 0xff
, if not the table was corrupt… But I don’t think that is true. The picture I am trying to read is fine.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Ideal image sizes and formats for your posts
In this guide, we'll share basic information about the recommended sizes and formats you should use for your images when crafting your posts ......
Read more >Sharp unable to read file buffer - node.js
1 Answer 1 · Maybe check the type of your provided input req.files.image.data one more time. Is it really a not corrupted image...
Read more >Buffer size is not sufficient - MSDN - Microsoft
In my application. From one place I am reading the file (image) and trying to get it displayed in wpf screen as WriteableBitmap....
Read more >image - Rust
Read a tuple containing the (width, height) of the image located at the specified path. This is faster than fully loading the image...
Read more >OpenCV: Image file reading and writing
The function imdecode reads an image from the specified buffer in the memory. ... when the function is called repeatedly for images of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@netroy I want to report back. I tried again with a URL (didn’t need a buffer…) from local tmp. storage, and that worked for me atleast it seems !
Sorry for wasting your time. I am not sure why I am getting errors… Those .jpeg-pictures are the only one I’ve tried, and won’t work for me. As said, I am using a buffer recived from a download-URL. I am using Google Cloud Storage. I can give you the snippet of code I am using server side with Node.JS 8 (Google Firebase Functions) to try and get the dimensions. (I also get error when trying to use exif-parser (Invalid JPEG section offset at Object.parseSections (…))).
I might for now just get the dimensions locally with JS and storing the original dimensions in the pictures custom metadata on upload, for later auto. resizing and compression on serverside.
TypeScript:
The way I am using (that works) on client side:
The logic I try to use on server: