JPEGImageEncoder / JPEGCodec replacement - IBM AS400

This is a discussion on JPEGImageEncoder / JPEGCodec replacement - IBM AS400 ; Hi, i wrote a class that resizes images, but it uses the propietary JPEGImageEncoder / JPEGCodec sun classes, and when i copy it to my iseries it doesn't work. This is the code: OutputStream os = new FileOutputStream("file.jpg"); JPEGImageEncoder encoder ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: JPEGImageEncoder / JPEGCodec replacement

  1. JPEGImageEncoder / JPEGCodec replacement

    Hi, i wrote a class that resizes images, but it uses the propietary
    JPEGImageEncoder / JPEGCodec sun classes, and when i copy it to my
    iseries it doesn't work.


    This is the code:

    OutputStream os = new FileOutputStream("file.jpg");
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
    encoder.encode(bi); //bi is the BufferedImage i want to save
    os.flush();
    os.close();

    Is there a replacement i can use?

  2. Re: JPEGImageEncoder / JPEGCodec replacement

    Seguros Catatumbo writes:

    > Is there a replacement i can use?


    The JIMI package available from Sun contains routines to write JPEG's,
    and is quite easy to use. See http://java.sun.com/products/jimi/

    The Java Advanced Imaging library from Sun has a very steep learning
    curve which may pay off speedwise if you need that.

    I found that setting java.compiler to jitc as recommended in the
    documentation gave better performance for large jobs (small ones were
    severely hit by the JIT warming up period).
    --
    Thorbjørn Ravn Andersen

  3. Re: JPEGImageEncoder / JPEGCodec replacement

    Thorbjoern Ravn Andersen writes:

    > I found that setting java.compiler to jitc as recommended in the
    > documentation gave better performance for large jobs (small ones were
    > severely hit by the JIT warming up period).


    Please also note that you can discover these traps by using the IBM
    JDK instead of the Sun JDK for your Windows development work (as these
    routines are not there).

    An easy way to get the IBM JDK is by downloading the "IBM Development
    Package for Eclipse" from
    http://www.ibm.com/developerworks/java/jdk/eclipse/ - free
    registration required.
    --
    Thorbjørn Ravn Andersen

  4. Re: JPEGImageEncoder / JPEGCodec replacement

    On 22 nov, 15:46, Thorbjoern Ravn Andersen
    wrote:
    > Thorbjoern Ravn Andersen writes:
    >
    > > I found that setting java.compiler to jitc as recommended in the
    > > documentation gave better performance for large jobs (small ones were
    > > severely hit by the JIT warming up period).

    >
    > Please also note that you can discover these traps by using the IBM
    > JDK instead of the Sun JDK for your Windows development work (as these
    > routines are not there).
    >
    > An easy way to get the IBM JDK is by downloading the "IBM Development
    > Package for Eclipse" fromhttp://www.ibm.com/developerworks/java/jdk/eclipse/- free
    > registration required.
    > --
    > Thorbjørn Ravn Andersen


    I use IBM Rational as my ide, so i am surprised to see that it
    imported the com.sun classes and that it worked perfectly on my
    websphere box.
    The error i actually get is "no cmm in java.library.path", which by
    googling i found out that either my problem is that i don't have the
    JPEG bits
    or that i need to turn awt headless mode in the iseries preferences.

    I found out alternate code, but i get an error 500 and weird enough, i
    don't get any debugging info on the ide's consote:

    OutputStream os = new FileOutputStream(newfile);
    ImageIO.write(bi, "jpeg", os); //bi is a bufferedimage
    os.flush();
    os.close();

  5. Re: JPEGImageEncoder / JPEGCodec replacement

    Seguros Catatumbo writes:

    > The error i actually get is "no cmm in java.library.path", which by
    > googling i found out that either my problem is that i don't have the
    > JPEG bits or that i need to turn awt headless mode in the iseries
    > preferences.


    You will need to turn on headless mode - by far the easiest.

    It is a matter of setting a property either from the command line or
    inside the application before doing graphics work.

    > ImageIO.write(bi, "jpeg", os); //bi is a bufferedimage


    Doesn't ring a bell, sorry.

    --
    Thorbjørn Ravn Andersen

  6. Re: JPEGImageEncoder / JPEGCodec replacement

    il 22/11/2007 19.34, Scrive Seguros Catatumbo 40725728:
    > Hi, i wrote a class that resizes images, but it uses the propietary
    > JPEGImageEncoder / JPEGCodec sun classes, and when i copy it to my
    > iseries it doesn't work.

    AFAIK Sun codec is NOT 100% java, it needs to load native libraries, so
    they're platform specific.
    --
    Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherAñe joAlcoolInside
    Spaccamaroni andate a cagare/Spammers not welcome/Spammers vão à merda
    Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
    schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'

+ Reply to Thread