Coder Social home page Coder Social logo

pbs.convert raise an error about sh HOT 4 CLOSED

amoffat avatar amoffat commented on July 17, 2024
pbs.convert raise an error

from sh.

Comments (4)

ifduyue avatar ifduyue commented on July 17, 2024

convert is a command tool ImageMagick provides

from sh.

amoffat avatar amoffat commented on July 17, 2024

Hi Du, unfortunately this is a problem with how pbs and shlex split up arguments. There will be a workaround in v1.0 if I can find it, but in the meantime, you can do this:

pbs.convert("-crop", "+0+67", "some.jpg", "crop.jpg")

from sh.

amoffat avatar amoffat commented on July 17, 2024

Just an update, there will be no workaround in v1.0. It seems that the best way to handle passing arguments to commands is to split them up with the understanding that 1 argument to the pbs command should correspond to 1 argument being passed to the subprocess. I've updated the readme to reflect this.

So in other words, this:

pbs.convert("-crop +0+67", "some.jpg", "crop.jpg")

should always be this:

pbs.convert("-crop", "+0+67", "some.jpg", "crop.jpg")

Because "-crop" and "+0+67" are separate arguments to the "convert" binary, and using shlex.split() to split up arguments automagically is broken and full of problems.

from sh.

ifduyue avatar ifduyue commented on July 17, 2024

pbs.convert("-crop", "+0+67", "some.jpg", "crop.jpg") works.

thanks, amoffat.

from sh.

Related Issues (20)

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.