Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Input file contains unsupported image format #2554

Closed
chris-hammond opened this issue Jan 28, 2021 · 4 comments
Closed

Error: Input file contains unsupported image format #2554

chris-hammond opened this issue Jan 28, 2021 · 4 comments
Labels

Comments

@chris-hammond
Copy link

The following issue appears to be related to previous libvips issue: #2023, but is occurring with the latest package versions. The suggested fix for the related gatsby issue did not help.

Using [email protected], with the following versions:

  aom: '2.0.1',
  cairo: '1.17.4',
  exif: '0.6.22',
  expat: '2.2.10',
  ffi: '3.3',
  fontconfig: '2.13.93',
  freetype: '2.10.4',
  fribidi: '1.0.10',
  gdkpixbuf: '2.42.2',
  gettext: '0.21',
  gif: '5.1.4',
  glib: '2.67.1',
  gsf: '1.14.47',
  harfbuzz: '2.7.2',
  heif: '1.10.0',
  jpeg: '2.0.6',
  lcms: '2.11',
  orc: '0.4.32',
  pango: '1.48.0',
  pixman: '0.40.0',
  png: '1.6.37',
  svg: '2.50.2',
  spng: '0.6.1',
  tiff: '4.2.0',
  vips: '8.10.5',
  webp: '1.1.0',
  xml: '2.9.10',
  zlib: '1.2.11'
}

What are the steps to reproduce? Use the following code:

const sharp = require('sharp');

console.log(sharp.versions);

console.log(sharp.format.png);

async function openFile(input) {
  return await sharp(input).metadata();
}

openFile("src/img/icon.png")
  .then((result) => {
    console.log(result);
  })
  .catch((err) => {
    console.error(err);
    process.exit(1);
  });

What is the expected behaviour?
The code should successfully open the file and report the metadata. Instead the code reports [Error: Input file contains unsupported image format].

Are you able to provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem?
See above.

Are you able to provide a sample image that helps explain the problem?
This error occurs with all images, regardless of image or format.

What is the output of running npx envinfo --binaries --system?

  System:
    OS: Linux 4.15 Ubuntu 20.04.1 LTS (Focal Fossa)
    CPU: (36) x64 Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz
    Memory: 19.03 GB / 68.69 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 12.20.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /tmp/workspace/node_modules/.bin/yarn
    npm: 6.14.10 - /usr/local/bin/npm
@lovell
Copy link
Owner

lovell commented Jan 29, 2021

This error occurs with all images, regardless of image or format.

Please can you create a minimal, standalone repo with a package.json, this code and a sample image that allows someone else to reproduce it.

@lovell lovell added question and removed triage labels Jan 29, 2021
@chris-hammond
Copy link
Author

Shoot. Turns out I'd changed build images and lost git-lfs. Nothing seemed wrong when I ls-ed the image directory, but ls -al finally threw some red flags in my head. Nothing wrong with sharp, although it would have save me hours of time if the error message could have told me that it was trying to process a text file... :-P Might be a worthwhile feature to add, but I'm not sure how difficult it would be.

@AlastairTaft
Copy link

I get this error inconsistency when running over a data set of about 100 images. If I close a bunch of programs down on my laptop I get further through the list. Seems like it could be a memory leak.

@lovell
Copy link
Owner

lovell commented Sep 18, 2021

@AlastairTaft If you're still having problems, please open a new issue with complete, standalone code sample and image(s) that allow someone else to reproduce.

Repository owner locked and limited conversation to collaborators Sep 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants