Git Product home page Git Product logo

Comments (8)

jcsalterego avatar jcsalterego commented on August 28, 2024

Sounds like a good idea, though I'd have to think of the right CLI interface, since right now it's pngpaste thefile.png, so perhaps pngpaste --auto-detect-extension thefile or pngpaste -a thefile? Either way, I can try to incorporate any format detection code this week if you have any contributions there.

from pngpaste.

igr avatar igr commented on August 28, 2024

You might even skip autodetection for now - just use the target extension, i.e.:

pngpaste foo.png       // will copy PNG
pngpaste bar.jpg       // will copy JPEG

I am not osx dev, but looking the code, can you simply replace png with jpeg and make it work ;)))?

from pngpaste.

jcsalterego avatar jcsalterego commented on August 28, 2024

Yeah true, that's much simpler, though would pngpaste be responsible for performing a conversion?

I'll take a look this week and update this issue.

from pngpaste.

igr avatar igr commented on August 28, 2024

Thank you!
what conversion? you mean from png to jpg, or? Would it be possible that when I copy a jpg file (like from webpage), simply store that content in a file, without any conversion?

from pngpaste.

jcsalterego avatar jcsalterego commented on August 28, 2024

what conversion? you mean from png to jpg, or? Would it be possible that when I copy a jpg file (like from webpage), simply store that content in a file, without any conversion?

Yeah, I mean if the user has copied a JPEG, but tries pngpaste some.png, or the user has copied a PNG, but tries pngpaste some.jpg.

from pngpaste.

igr avatar igr commented on August 28, 2024

Got it. Well, for the first version you can just throw an error; if conversion is too much work :)

I would not expect from your tool to do conversion, that might be out of scope, and conversions may be complex. I would rather work on autodetection so when you don't specify the extension:

pngpaste foo

it will detect the right pic format and store it in eg foo.jpg or foo.png or foo.tiff :)

from pngpaste.

jcsalterego avatar jcsalterego commented on August 28, 2024

So unfortunately I dug into it and AppKit's API doesn't expose the original source's format. It just comes back as a "bitmap" and there's no clear enum or string that indicates whether the source was a JPEG, a PNG, a GIF, etc.

Thus, #9 does allow for pngpaste foo.jpg but there's no auto-detection of the actual source. This is the data structure provided - https://developer.apple.com/reference/appkit/nsbitmapformat?language=objc - and it is not quite helpful in the detection endeavor.

from pngpaste.

jcsalterego avatar jcsalterego commented on August 28, 2024

Going ahead and closing this.

from pngpaste.

Related Issues (17)

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.