GithubHelp home page GithubHelp logo

caramelfur / qoi-img Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 294 KB

Typescript bindings for QOI (QOIxx and qoi-stream), both streaming and normal encoding and decoding

Home Page: https://www.npmjs.com/package/qoi-img

License: GNU General Public License v3.0

Python 0.77% C++ 67.36% TypeScript 13.50% JavaScript 0.13% C 18.24%
encoding qoi typescript bindings decoding image

qoi-img's People

Contributors

caramelfur avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

qoi-img's Issues

[question] webpack: Could not locate the bindings file

I developed a VSCode extension using this library and everything worked fine until I used webpack, but apparently the size of such a extension is too large.

I refer to this link to use webpack and it prompts the following error at runtime, I think it means that I haven't packaged addon.node into the project, but I don't know how to do it, could you please give some advice?

Activating extension 'Mupceet.qoi-viewer' failed: Could not locate the bindings file. Tried: 
→ /home/mupceet/Proj/qoi-viewer-for-vscode/qoi-viewer/build/qoixx_addon.node 
→ /home/mupceet/Proj/qoi-viewer-for-vscode/qoi-viewer/build/Debug/qoixx_addon.node 
→ /home/mupceet/Proj/qoi-viewer-for-vscode/qoi-viewer/build/Release/qoixx_addon.node 
→ /home/mupceet/Proj/qoi-viewer-for-vscode/qoi-viewer/out/Debug/qoixx_addon.node 
→ /home/mupceet/Proj/qoi-viewer-for-vscode/qoi-viewer/Debug/qoixx_addon.node 
→ /home/mupceet/Proj/qoi-viewer-for-vscode/qoi-viewer/out/Release/qoixx_addon.node 
→ /home/mupceet/Proj/qoi-viewer-for-vscode/qoi-viewer/Release/qoixx_addon.node 
→ /home/mupceet/Proj/qoi-viewer-for-vscode/qoi-viewer/build/default/qoixx_addon.node 
→ /home/mupceet/Proj/qoi-viewer-for-vscode/qoi-viewer/compiled/16.14.2/linux/x64/qoixx_addon.node 
→ /home/mupceet/Proj/qoi-viewer-for-vscode/qoi-viewer/addon-build/release/install-root/qoixx_addon.node 
→ /home/mupceet/Proj/qoi-viewer-for-vscode/q...

Suggestion: revise the QOIDecode API

function QOIDecode(data: Buffer, convertChannels?: QOIChannels) => {
  pixels: Buffer;
  width: number;
  height: number;
  channels: QOIChannels;
  colorspace: QOIColorSpace;
}

Regarding the design of this API, I think it needs to be discussed.

Here is the code:

  if (IsQOI(rawBuffer)) {
    let channel = rawBuffer.subarray(12, 13);
    if (channel.equals(Buffer.of(QOIChannels.RGB))) {
      // do rgb decode
      qoiData = QOIdecode(rawBuffer, QOIChannels.RGBA);
    } else if (channel.equals(Buffer.of(QOIChannels.RGBA))) {
      // do rgba decode
      qoiData = QOIdecode(rawBuffer, QOIChannels.RGBA);
    } else {
      // log it
    }
  }

I don't think the convertChannels input parameter should be passed in by the caller, since the caller doesn't know the format of the original data. In addition, according to the QOI format specification, it can be parsed from the original data.

The channels and colorspace of the value returned by this method are meaningful only in the scene of automatically parsing the original data.

../lib/qoixx.hpp:11:9: fatal error: bit: no such file or directory

I encountered the following error when I installed the module, what should I do?

npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm ERR! code 1
npm ERR! path /home/mupceet/Proj/qoi-viewer-for-vscode/pbm-ppm-pgm-viewer-for-vscode/node_modules/qoi-img
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
npm ERR! make: enter dir “/home/mupceet/Proj/qoi-viewer-for-vscode/pbm-ppm-pgm-viewer-for-vscode/node_modules/qoi-img/build”
npm ERR!   CXX(target) Release/obj.target/qoixx_addon/lib/qoi.o
npm ERR! make: leave dir “/home/mupceet/Proj/qoi-viewer-for-vscode/pbm-ppm-pgm-viewer-for-vscode/node_modules/qoi-img/build”
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/mupceet/Proj/qoi-viewer-for-vscode/pbm-ppm-pgm-viewer-for-vscode/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/mupceet/Proj/qoi-viewer-for-vscode/pbm-ppm-pgm-viewer-for-vscode/node_modules/qoi-img/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/mupceet/Proj/qoi-viewer-for-vscode/pbm-ppm-pgm-viewer-for-vscode/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/mupceet/.cache/node-gyp/19.1.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/mupceet/.cache/node-gyp/19.1.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/mupceet/Proj/qoi-viewer-for-vscode/pbm-ppm-pgm-viewer-for-vscode/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/mupceet/.cache/node-gyp/19.1.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/mupceet/Proj/qoi-viewer-for-vscode/pbm-ppm-pgm-viewer-for-vscode/node_modules/qoi-img',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../lib/qoi.cpp:5:
npm ERR! ../lib/qoixx.hpp:11:9: fatal error: bit: no such file or directory
npm ERR!  #include<bit>
npm ERR!          ^~~~~
npm ERR! compilation terminated.
npm ERR! make: *** [qoixx_addon.target.mk:115:Release/obj.target/qoixx_addon/lib/qoi.o] error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/home/mupceet/Proj/qoi-viewer-for-vscode/pbm-ppm-pgm-viewer-for-vscode/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 5.15.45-amd64-desktop
npm ERR! gyp ERR! command "/home/mupceet/.config/nvm/versions/node/v19.1.0/bin/node" "/home/mupceet/Proj/qoi-viewer-for-vscode/pbm-ppm-pgm-viewer-for-vscode/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /home/mupceet/Proj/qoi-viewer-for-vscode/pbm-ppm-pgm-viewer-for-vscode/node_modules/qoi-img
npm ERR! gyp ERR! node -v v19.1.0
npm ERR! gyp ERR! node-gyp -v v9.3.0
npm ERR! gyp ERR! not ok

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.