Unable to process images (jpg) taken with a OnePlus 15R SmartPhone camera
question
Hello Lovell,
I am in the way of porting/bundling the IMMICH self-hosted image solution (https://immich.app/) to the FreeBSD platform. They are using your SHARP framework for rendering thumbnails of uploaded images.
Things worked well until I shifted to a new SmartPhone, from a OnePlus 8T to a OnePlus 15R.
Apparently the camera app of the new OnePlus 15R is creating JPGs which cannot be handled by SHARP, see below.
Perhaps you can give me a hint how I can fix that? I understand that SHARP is using libvips, and on FreeBSD, the "vips" package comes with a CLI "vipsthumbnail". Using that, I can successfully create thumbnails of the images taken with the OnePlus 15 camera.. I have attached a PC screen snapshot taken with the camera below which demonstrates the problem.
If I use ImageMagick to convert the image to an different format (say PNG) and back to JPG, it can be handled by SHARP..
### Is this a possible bug in a feature of sharp, unrelated to installation?
- [x] Running `npm install sharp` completes without error.
- [x] Running `node -e "require('sharp')"` completes without error.
- [x] I am using the latest version of `sharp` as reported by `npm view sharp dist-tags.latest`.
### What is the output of running `npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp`?
System:
OS: freebsd
CPU: (4) x64 Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
Memory: 369.70 MB / 15.78 GB
Binaries:
Node: 24.14.1 - /usr/local/bin/node
npm: 11.12.1 - /usr/local/bin/npm
Deno: 2.7.10 - /usr/local/bin/deno
npmPackages:
sharp: ^0.34.5 => 0.34.5
- [x] Adding `sharp.cache(false)` does not fix this problem.
### Does this problem relate to images appearing to have been rotated by 90 degrees?
Images that contain EXIF Orientation metadata are not auto-oriented. By default, EXIF metadata is removed.
- To auto-orient pixel values use the parameter-less [`rotate()`](https://sharp.pixelplumbing.com/api-operation#rotate) operation.
- To retain EXIF Orientation use [`keepExif()`](https://sharp.pixelplumbing.com/api-output#keepexif).
- [x] Using `rotate()` or `keepExif()` does not fix this problem.
### What are the steps to reproduce?
```
node -e "const sharp = require('sharp'); sharp.cache(false); sharp('input.jpg').resize(200).toFile('output.jpg');"
node_modules/sharp/lib/output.js:90
const stack = Error();
^
Error: Input file contains unsupported image format
at Sharp.toFile node_modules/sharp/lib/output.js:90:19)
at [eval]:1:84
at runScriptInThisContext (node:internal/vm:219:10)
at node:internal/process/execution:451:12
at [eval]-wrapper:6:24
```
### What is the expected behaviour?
Create a resized copy (thumbnail) of the input image
### Please provide sample image(s) that help explain this problem
<img width="2662" height="3044" alt="Image" src="https://github.com/user-attachments/assets/3c925159-1545-4049-b813-d29d76620a5b" />
关闭于 2026-04-26 2 条评论