GithubHelp home page GithubHelp logo

Comments (5)

haraldk avatar haraldk commented on May 23, 2024

Hi again,

Still sorry about the state of the documentation. :-/

You should be able to use it just like normal ImageIO. No changes required. You do however need all of the dependencies of the imageio-jpeg plugin in classpath as well.

You probably need all these (update: fixed some typos):
twelvemonkeys-common-lang-3.0-SNAPSHOT.jar
twelvemonkeys-common-io-3.0-SNAPSHOT.jar
twelvemonkeys-common-image-3.0-SNAPSHOT.jar
twelvemonkeys-imageio-core-3.0-SNAPSHOT.jar
twelvemonkeys-imageio-metadata-3.0-SNAPSHOT.jar
twelvemonkeys-imageio-jpeg-3.0-SNAPSHOT.jar

Hope that helps.

If not, let me know how/in what way it does not work, and I'll look into it.

Regards,

Harald K

from twelvemonkeys.

Fanvaron avatar Fanvaron commented on May 23, 2024

Hello Harald,
that helped me thanks, but I'm still not sure how to call the read() method, what do I need to import and where do I get my object, or is there a static method somewhere that I overlooked?
Maybe a very simple example would help me.

Thanks

from twelvemonkeys.

haraldk avatar haraldk commented on May 23, 2024

When you have everything set up on class path, it really is as simple as:

BufferedImage image = ImageIO.read(jpegFile);

No special imports, no special method. The reason this works, is that ImageIO is plugin-based, and the plugin is automatically registered using SPI (service provider interface). If you want to learn more about how this works, I suggest you read http://docs.oracle.com/javase/7/docs/api/javax/imageio/spi/IIORegistry.html and http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#Service_Provider :-)

The only exception (of course there's one) I know of, is if you add the plugins to the class path after ImageIO has been initialized (like in a web app), then you might have to add the line:

ImageIO.scanForPlugins();

Make sure you do this only once. If you are indeed doing this from a web app, you should also read http://stackoverflow.com/a/17365294/1428606 to avoid adding a memory leak to your application.

Ok, long answer, but I think that covers most of it. :-)

Best regards,

Harald K

from twelvemonkeys.

Fanvaron avatar Fanvaron commented on May 23, 2024

Woho it works now!
thanks, yeah I always made the mistake and didn't import the ImageIO.
Thanks as well for the background info that looks really interesting.

from twelvemonkeys.

haraldk avatar haraldk commented on May 23, 2024

Cool. Happy coding! :-)

from twelvemonkeys.

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.