question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: No matching constructor overloading was found.

See original GitHub issue

Expected Behavior

Create a new PNG file

Current Behavior

Error: No matching constructor overloading was found. Please see the docs for how to call the Jimp constructor.

Failure Information (for bugs)

Steps to Reproduce

    let pixelData = new Uint8Array(dataset.byteArray.buffer, pixelDataElement.dataOffset, pixelDataElement.length);

    new Jimp({ data: pixelData, width: columns, height: rows }, (err, image) => {
                console.log(err);
                console.log(image);
            });

Context

  • Jimp Version: 0.5.6
  • Operating System: Ubuntu 18.04.1
  • Node version: 10.12.0

Failure Logs

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:8
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ahmadawaiscommented, Jul 9, 2020

I have the same problem with any image I give to this function.

ℹ REASON →

No matching constructor overloading was found. Please see the docs for how to call the Jimp constructor.

/* RESIZE OPTIMIZE IMAGES */
const Jimp = require('jimp');

/**
 * Resize + optimize images.
 *
 * @param Object options Customizable Options.
 * @param Array images An array of images paths.
 * @param Number width A number value of width e.g. 1920.
 * @param Number height Optional number value of height e.g. 1080.
 * @param Number quality Optional number value of quality of the image e.g. 90.
 */
module.exports = async (options = {}) => {
	const defaultOptions = {
		images: [],
		width: 1920,
		height: Jimp.AUTO,
		quality: 90
	};

	const opt = { ...defaultOptions, ...options };
	await Promise.all(
		opt.images.map(async imgPath => {
			const image = await Jimp.read(imgPath);
			await image.resize(opt.width, opt.height);
			await image.quality(opt.quality);
			await image.writeAsync(imgPath);
		})
	);
};

2reactions
ahmadawaiscommented, Jul 9, 2020

Turns out it was an issue with the path of the image.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jimp error: No matching constructor overloading was found
Without know what specific error you're trying to handle against, the best way is to wrap your entire section of code in a...
Read more >
Jimp error: No matching constructor overloading was found ...
When the user didn't provide the argument, I'm guessing msg.attachments.first() returns undefined which is why Jimp errors. if (!args[1]) { return msg.channel.
Read more >
new | JS++ & JavaScript Documentation - Onux
If the class being instantiated has overloaded constructors, the compiler will ... If no matching constructor is found, the compiler will raise an...
Read more >
No Matching Constructor Overloading Was Found With Simple ...
I get the error "no matching constructor for initialization of 'MyClass'" + Operator overload. MyClass I dont even understand, why it is not...
Read more >
Getting error: no matching constructor for initialization ... - Reddit
Getting error: no matching constructor for initialization of ... on CLion MacOS while my colleagues working on the same repo are able to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found