vseventer / sharp-cli

CLI for sharp.
MIT License
189 stars 20 forks source link

Add support PPM files #81

Open alanwilter opened 1 year ago

alanwilter commented 1 year ago

Why sharp does not work with PPM files?

vseventer commented 1 year ago

You might have to compile libvips with PPM support.

alanwilter commented 1 year ago

Is there a recipe somewhere to build sharp with PPM support? I've followed https://sharp.pixelplumbing.com/install for my basic node installation.

My platform is Ubuntu 20.04.3 LTS x86_64.

vseventer commented 1 year ago

Is there a recipe somewhere to build sharp with PPM support? I've followed https://sharp.pixelplumbing.com/install for my basic node installation.

My platform is Ubuntu 20.04.3 LTS x86_64.

I think you want to try and use a custom libvips with PPM support - https://sharp.pixelplumbing.com/install#custom-libvips

alanwilter commented 1 year ago

I'm trying, I've installed Ubuntu libvips and its tools, so with nip2 I can open PPM files, I guess then ubuntu libvips supports PPM.

Then I tried:

npm install -g sharp-cli --build-from-source --verbose
npm verb cli /home/awilter/.nvm/versions/node/v18.0.0/bin/node /home/awilter/.nvm/versions/node/v18.0.0/bin/npm
npm info using npm@9.6.1
npm info using node@v18.0.0
npm verb title npm install sharp-cli
npm verb argv "install" "--global" "sharp-cli" "--build-from-source" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:/home/awilter/.npm/_logs/2023-03-14T14_53_52_348Z-
npm verb logfile /home/awilter/.npm/_logs/2023-03-14T14_53_52_348Z-debug-0.log
npm http fetch GET 200 https://registry.npmjs.org/sharp-cli 318ms (cache revalidated)
...
npm http fetch GET 200 https://registry.npmjs.org/ansi-styles 40ms (cache revalidated)
npm info run sharp@0.31.2 install node_modules/sharp-cli/node_modules/sharp (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm info run sharp@0.31.2 install { code: 0, signal: null }

changed 70 packages in 16s

13 packages are looking for funding
  run `npm fund` for details
npm verb exit 0
npm info ok

But I doubt it did what I wanted. Anyway, sharp -i example.ppm still does not work on my linux.

What am I still missing?

alanwilter commented 1 year ago

I removed sharp, started with with a new nodejs, build /usr/local/include/vips, did npm install -g sharp-cli --build-from-source --verbose and after some error interaction I've installed all the lib*-dev that was missing in my Ubuntu and then I've got sharp with PPM support, Hooray!

But not for so long. In the process I managed to lose avif support, though I have installed /usr/local/include/avif.

Any clue?

vseventer commented 1 year ago

Not sure - my installation process on Mac using brew is a bit different - maybe worth asking in the main repos' issue tracker.

alanwilter commented 1 year ago

I'm wondering which lib provides avif. I mean, should I have to build libvips with avif support?