jimp-dev / jimp

An image processing library written entirely in JavaScript for Node, with zero external or native dependencies.
http://jimp-dev.github.io/jimp/
MIT License
13.95k stars 762 forks source link

TypeError: Jimp.read is not a function #1329

Closed gangaswamy closed 3 weeks ago

gangaswamy commented 3 weeks ago

Expected Behavior

Unable to read image file or buffer. It is giving an error stating read is not function

here is my code written in nodjs

const Jimp = require('jimp');

async function jmpRead(){

let img = await Jimp.read('blank.jpg');

}

jmpRead();

Current Behavior

let img = await Jimp.read('blank.jpg'); ^

TypeError: Jimp.read is not a function

Failure Information (for bugs)

node test4.js /opt/projects/faceai/samples/faceapi/test4.js:5 let img = await Jimp.read('blank.jpg'); ^

TypeError: Jimp.read is not a function at jmpRead (/opt/projects/faceai/samples/faceapi/test4.js:5:26) at Object. (/opt/projects/faceai/samples/faceapi/test4.js:8:1) at Module._compile (node:internal/modules/cjs/loader:1469:14) at Module._extensions..js (node:internal/modules/cjs/loader:1548:10) at Module.load (node:internal/modules/cjs/loader:1288:32) at Module._load (node:internal/modules/cjs/loader:1104:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) at node:internal/main/run_main_module:28:49

Node.js v20.17.0

Steps to Reproduce

just run above simple code

IF YOUR ISSUE DEPENDS ON A PARTICULAR IMAGE BE SURE TO INCLUDE THIS AS WELL. WE CAN'T REPRODUCE IF WE DON'T HAVE YOUR IMAGE

  1. step 1
  2. step 2
  3. you get it... -->

Screenshots

Context

Failure Logs

hipstersmoothie commented 3 weeks ago

The new import style is

const { Jimp } = require('jimp');

http://jimp-dev.github.io/jimp/guides/migrate-to-v1/