lovell / lovell/sharp

Enhancement: Optional input file type extension to hint at best loader for Buffer/Stream

Open
#4,562 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
32.7k
Forks
1.4k
Avg merge
1d 14h
Merged PRs (30d)
5

Description

## Question about an existing feature

Is it possible to pass a hint to libvips to know which loader to use?

### What are you trying to achieve?

Using libvips (with libraw enabled) via Sharp to open RAW files. This works fine for most files I tested, but it fails for NEF files, which have a TIFF header. When opening a NEF file in Sharp I get a very small TIFF image (thumbnail?), not the full image.

### When you searched for similar issues, what did you find that might be related?

I suspect this could be because of the TIFF header of NEF files. I think libvips tries [to detect NEF files based on the filename](https://github.com/libvips/libvips/issues/3380), if sharp hands off a buffer or the already opened file maybe that's the reason why the file is then loaded as TIFF.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Sharp's Buffer/Stream input path and how it delegates loader detection to libvips, using the NEF/TIFF behavior described in the issue as the reproduction case. Check the referenced libvips issue for loader-detection constraints. Done should include an optional extension hint that selects the intended loader and coverage for NEF input delivered through a Buffer or Stream.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.