Com.sun.image.codec.jpeg output

Dear developers, I must capture the message
"Not a JPEG file: starts with"
and the message
"Corrupt JPEG data: premature end of data segment"
This message does not raise none exception.
Have you any idea?
Thanks.

I need some help. My predecessor created an
application that calls the "com.sun.image.codec.jpeg"
package. The client's java installation is the
standard install and does not include this package.
How do I find, download and install this in the
client's environment? Also the client is running NT
4.0 Workstation. Thanks!What does "standard install" mean? What version of the jre are they using? You can find out by typing:
java -version
Packages that begin com.sun... aren't part of the standard API, and aren't guaranteed to be supported -- as you are painfully aware. This particular package was for doing jpeg image I/O. If your client is using jre version 1.4, you can use javax.imageio.ImageIO to do this. If your predecessor was doing some straightforward I/O, the changes could only be a few lines -- more easily done than trying to install non-standard packages...

Similar Messages

  • How to get import com.sun.image.codec.jpeg.*;..Help..

    I’m doing a research for video compression n I need to compress the frame as image, I want to use com.sun.image.codec.jpeg.* , but I can’t download the plugin every where. I use JDK 1.5.0 to do my java program. Does any one have a suggestion about my problem? What should I do, so I can use com.sun.image.codec.jpeg.*?
    thanks

    That is part of the following:
    [http://java.sun.com/javase/technologies/desktop/media/2D/]

  • Package  com.sun.image.codec.jpeg

    i believe package com.sun.image.codec.jpeg does not come with the JDK...right ? where from i can download it ?
    However , i was surprised to see that JSP in tomcat is able to import
    <%@ page import="com.sun.image.codec.jpeg.*" %> // No ERROR !!

    thanks .....
    strange ......
    C:\tomcat\common\lib
    AND
    C:\tomcat\webapps\myapps\WEB-INF\lib
    No rt.jar is there .
    Anyway, where from it is downloaded if i want to use that pack ?

  • Com.sun.image.codec.jpeg package

    I need some help. My predecessor created an application that calls the "com.sun.image.codec.jpeg" package. The client's java installation is the standard install and does not include this package. How do I find, download and install this in the client's environment? Also the client is running NT 4.0 Workstation. Thanks!

    I need some help. My predecessor created an
    application that calls the "com.sun.image.codec.jpeg"
    package. The client's java installation is the
    standard install and does not include this package.
    How do I find, download and install this in the
    client's environment? Also the client is running NT
    4.0 Workstation. Thanks!What does "standard install" mean? What version of the jre are they using? You can find out by typing:
    java -version
    Packages that begin com.sun... aren't part of the standard API, and aren't guaranteed to be supported -- as you are painfully aware. This particular package was for doing jpeg image I/O. If your client is using jre version 1.4, you can use javax.imageio.ImageIO to do this. If your predecessor was doing some straightforward I/O, the changes could only be a few lines -- more easily done than trying to install non-standard packages...

  • Com.sun.image.codec.jpeg

    i'm looking for this package to include it in my webobject environement.
    I dont know were to find it exacly. (I speak french and i'm a little lost on the sun website.
    thanks

    You probably already have it. I know it comes bundled with java 1.3 and 1.4 (it might come with earlier versions too)

  • Com.sun.image.codec.jpeg package license?

    Does Sun's regular Java license cover the package in question? Meaning, can it be used in commercial products and delivered to the customer with the product?
    Does it come with every JDK/JRE 1.2 ->?

    It's part of the jdk, so my guess would be yesYep. I guessed the same, but would like to have concrete info of it.:)
    I think that package is in the rt.jar in versions 1.2
    / 1.3 / 1.4. However it's a non-standard package and
    if you're using 1.4 you should use the standard
    ImageIO class.I'm using 1.3, so it should be fine. The licensing just puzzles me, because I have to know for certain if it can be freely used in commercial products (within Java license terms).

  • Com.sun.image.codec.jpeg package and different platforms?

    I heard that this package is SunOS specific. Is that true? What platforms does it support for real?
    I have been trying to find more info than just the API documentation and haven't succeeded so far. Anybody know where I can retrieve more info on that package?

    Java is platform independent right? .. bundle the packages you use (that's not in the JDK) and it will work on *nix as well.
    You can usa tool like JDeploy (use google) to find out class dependencies etc. when you bundle your JAR (although this won't work if you use class.forName() etc.);
    - bjorn

  • Sun.image.codec.jpeg package

    where do i get
    com.sun.image.codec.jpeg package from???
    Thanks,
    Dimple.

    It is avalable with jdk1.2.2/1.3
    http://java.sun.com/products/java-media/jai/index.html

  • How can i convert an image into gif file as jpeg by using com.sun.image.*

    please help me to convert an image into gif format. i have used sun's impl com.sun.image.code.jpeg package to convert a buffered image into a jpeg file. is there any implementatioln available from sun to handle gif files.

    Many. Try for instance google with 'java image encoders'. Go to the URL http://www.google.com/search?q=java+image+encoders and be amazed of the wonders of modern web search tools.

  • HOW do you use "com.sun.media.codec.video.jpeg.NativeEncoder"???

    Hi!! I want to know if I can use this encoder (NativeEncoder) for encoding to MJPG.
    If I do: PlugInManager.getPlugInList(new VideoFormat( VideoFormat.RGB),
                        new VideoFormat(VideoFormat.MJPG), PlugInManager.CODEC);
    I obtain only one codec:com.sun.media.codec.video.jpeg.NativeEncoder
    BUT, then, I do: codec.setInputFormat(new VideoFormat( VideoFormat.RGB))-->It returns me:NULL. why????!!!
    Regards!

    The input format may have to be more specific and suitable; eg for Windows :-
    RGBFormat(new Dimension(w,h), w*h*3, Format.byteArray, -1.0F, 24, 3, 2, 1, 3, w*3,-1,-1)

  • Where to download  "sun.awt.image.codec.JPEGImageDecoderImpl"/Windows

    Hello,
    I bought some Java API. These API uses com/sun/image/codec/jpeg/JPEGCodec.
    I found these clases in src.zip in java install directory.
    Then, this code has a source line
    "import sun.awt.image.codec.JPEGImageDecoderImpl;"
    Where can I find/downlad this class?
    (I work on Windows platform)

    This class is in rt.jar package
    which is in ur jre directory/lib
    Hope u got it!!
    Pradhip

  • Image to jpeg

    From an object java.awt.Image I must obtain an object byte[] type that have to
    contain an jpeg imaging type. For doing that I am using the attached code but it
    is very slow when it is in execution and it use a lot of energy from the
    system. How can i do in order to obtain the same result most quickly?
    Thank for you help.
    javax.media.Buffer buffergrabber= frameGrabber.grabFrame();
    java.awt.Image image= (new javax.media.util.BufferToImage((javax.media.format.VideoFormat)buffergrabber.getFormat()).createImage(buffergrabber));
    int pix[]= new int[image.getWidth(null) * image.getHeight(null)];
    java.awt.image.PixelGrabber pg= new java.awt.image.PixelGrabber(image, 0, 0, image.getWidth(null), image.getHeight(null), pix, 0, image.getWidth(null));
    pg.grabPixels();
    java.awt.image.BufferedImage bufferedimage= new java.awt.image.BufferedImage(image.getWidth(null), image.getHeight(null), java.awt.image.BufferedImage.TYPE_INT_RGB);
    for (int count= 0; count< image.getHeight(null); count++) {
        for (int count_2= 0; count_2< image.getWidth(null); count_2++) {
            bufferedimage.setRGB(count_2, count, pix[count * image.getWidth(null)+ count_2]);
    try {
        java.io.ByteArrayOutputStream bytearrayoutputstream= new java.io.ByteArrayOutputStream();
        com.sun.image.codec.jpeg.JPEGImageEncoder imageencoder= com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder(bytearrayoutputstream);
        com.sun.image.codec.jpeg.JPEGEncodeParam encoderparam= imageencoder.getDefaultJPEGEncodeParam(bufferedimage);
        imageencoder.setJPEGEncodeParam(encoderparam);
        encoderparam.setQuality(1.0F, true);
        imageencoder.encode(bufferedimage);
        byte MyJPEGImage[]= bytearrayoutputstream.toByteArray();
    catch(java.io.IOException e) {
        System.out.println(e);
    }

    Best to use the original.
    If youv lost it, remove any other objects over the image and size the image to fill the slide, then use export.

  • Com.sun.* Not Found only in NetBeans - Javac finds them fine!

    I am not sure what is up with this, but NetBeans will not let me specify anything from the com.* packages. It shows the packages in the auto-type boxes as I type in the name (com.sun.blahblahblah) but highlights the statement with a red underline and states 'Package not found".
    Just to let it be known, I have a look-and-feel demo java file downloaded from the net that compiled perfect and runs as expected, and it makes much use of the com.sun.* packages. And I can run NetBeans with the --laf command line option and it will run using any of the LAF's in the com.* packages itself, but still not see them in the IDE for coding use ><
    Any ideas?
    Thanks in advance.

    I just popped in what you wrote, and another thing just for giggles:
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    import com.sun.crypto.provider.*;and they threw no errors. Why is it that my laf is throwing errors when they are plainly there?
    Example -
           public void actionPerformed(ActionEvent event) {
             try {
               UIManager.setLookAndFeel(getText());
               SwingUtilities.updateComponentTreeUI(
                 ChangingLaF.this);
               // call myFrame.pack()
               // to resize frame for laf
             } catch (IllegalAccessException e) {
               // insert code to handle this exception
             } catch (UnsupportedLookAndFeelException e) {
               // insert code to handle this exception
             } catch (InstantiationException e) {
               // insert code to handle this exception
             } catch (ClassNotFoundException e) {
               // insert code to handle this exception
             }This is the code I got off the net, this + a bit more to the .java file of course, compiles perfect with javac. The programmer used the package path com.sun.blahblah as the radiobutton text, that is what the UIManager.setLookAndFeel(getText()); getText() nonsense is. But other than that I see no reason an erro should be thrown in netbeans over UIManager.setLookAndFeel(com.sun.java.swing.plaf.motif.MotifLookAndFeel);
    I did try it with quotes though as a previous post recomended and got this message:
    init:
    deps-jar:
    Compiling 1 source file to E:\Java Apps\Calendar\build\classes
    E:\Java Apps\Calendar\src\Main\MainFrame.java:283: unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
    1 error
    BUILD FAILED (total time: 0 seconds)
    <

  • Error saving TIF image with JPEG compression (IndexColorModel)

    Hi all,
    i recently came upon the following error:
    javax.imageio.IIOException: Metadata components != number of destination bands
         at com.sun.imageio.plugins.jpeg.JPEGImageWriter.checkSOFBands(JPEGImageWriter.java:1279)
         at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:694)
         at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:339)
         at com.sun.media.imageioimpl.plugins.tiff.TIFFBaseJPEGCompressor.encode(TIFFBaseJPEGCompressor.java:489)
         at com.sun.media.imageioimpl.plugins.tiff.TIFFImageWriter.writeTile(TIFFImageWriter.java:1835)
         at com.sun.media.imageioimpl.plugins.tiff.TIFFImageWriter.write(TIFFImageWriter.java:2686)trying to save a tif file with jpeg compression. The code used is this:
      public static void main(String[] args) throws Exception{
        String s = "c:/sample images/gray_bug/graybug.tif";
        BufferedImage bi = ImageIO.read(new File(s));
        File outFile = new File(s + "-out.tif");
        ImageWriter writer = (ImageWriter)ImageIO.getImageWritersByFormatName("TIF").next();
        ImageOutputStream ios = ImageIO.createImageOutputStream(outFile);
        ios.setByteOrder(ByteOrder.LITTLE_ENDIAN);
        writer.setOutput(ios);
        TIFFImageWriteParam writeParam = new TIFFImageWriteParam(Locale.ENGLISH);
        writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
        writeParam.setCompressionType("JPEG");
        writeParam.setCompressionQuality(1f);
        IIOImage iioImage = new IIOImage(bi, null, null);
        writer.write(null, iioImage, writeParam);     
        writer.reset();
        writer.dispose();
        ios.flush();
        ios.close();
      }The test image that creates the problem can be found here:
    http://s11.postimage.org/7wl195w8z/graybug.png
    Any ideas what might be wrong?
    I am using imageio 1.2-pre-dr-b04 and JDK 1.6.
    TIA,
    Costas

    I can't help you but here's an exercise for you. When you get an exception you can't explain yourself, try posting it in Google. With a catch: remove anything from the error message that is specific to you like a classname or a specific value.
    In this case there is nothing specific in the error message so try a search for "javax.imageio.IIOException: Metadata components != number of destination bands". One thing is for sure: you're not the first to run into this error.

  • Javax.imageio.IIOException: Insufficient memory (case 2)         at com.sun

    javax.imageio.IIOException: Insufficient memory (case 2)
    at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(J[BIII[IIIIII[Ljavax.imageio.plugins.jpeg.JPEGQTable;Z[Ljavax.imageio.plugins.jpeg.JPEGHuffmanTable;[Ljavax.imageio.plugins.jpeg.JPEGHuffmanTable;ZZZI[I[I[I[I[IZI)Z(Native Method)
            at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:971)
            at javax.imageio.ImageWriter.write(ImageWriter.java:598)
            at javax.imageio.ImageIO.write(ImageIO.java:1450)
            at javax.imageio.ImageIO.write(ImageIO.java:1515)
            at jsp_servlet._css.__code._jspService(__code.java:145)
            at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
            at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
            at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
            at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:230)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    <img border=0 src="code.jsp">
    the content of JSP file about:
    <%@ page import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*"%>
    <%@ page import="java.io.OutputStream"%>
    <%@ page pageEncoding="UTF-8"%>
    <%!Color getRandColor(int fc, int bc) {   
    Random random = new Random();
    if (fc > 255)
    fc = 255;
    if (bc > 255)
    bc = 255;
    int r = fc + random.nextInt(bc - fc);
    int g = fc + random.nextInt(bc - fc);
    int b = fc + random.nextInt(bc - fc);
    return new Color(r, g, b);
    %>
    <%
    try {  
    out.clearBuffer(); // 加上这一句
    response.setHeader("Pragma", "No-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);
    int width = 70, height = 20;
    BufferedImage image = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB);
    OutputStream os = response.getOutputStream();
    Graphics g = image.getGraphics();
    Random random = new Random();
    //设置背景和大小
    g.setColor(getRandColor(200, 250));
    g.fillRect(0, 0, width, height);
    //设置字体和颜色
    g.setFont(new Font("Times New Roman", Font.BOLD, 20));
    g.setColor(getRandColor(120, 200));
    for (int i = 0; i < 50; i++) {   
    int x = random.nextInt(width);
    int y = random.nextInt(height);
    int xl = random.nextInt(5);
    int yl = random.nextInt(5);
    g.drawLine(x, y, x + xl, y + yl);
    String sRand = "";
    for (int i = 0; i < 4; i++) {
    String chose="0123456789";
    String rand = String.valueOf(chose.charAt(random.nextInt(chose.length())));
    sRand += rand;
    g.setColor(new Color(20 + random.nextInt(110), 20 + random.nextInt(110), 20 + random.nextInt(110)));
    g.drawString(rand, 15 * i + 6, 16);
    session.setAttribute("rand", new String(sRand));
    g.dispose();
    g=null;
    ImageIO.write(image, "JPEG", os);
    os.flush();
    os.close();
    os = null;
    response.flushBuffer();
    out.clear();
    out = pageContext.pushBody();
    } catch (IllegalStateException e) {   
    System.out.println(e.getMessage());
    e.printStackTrace();
    %>

Maybe you are looking for

  • Not able to run the job with user id - is

    Hello experts, We have problem. Every day we run the job. ( the job contians two programs called  ZTIBCOPRG  and J_5HJSTP  )). I would like to know why the above job is running with the user ID TIBCOADM.  Because this user has German settings for the

  • Having issue while uploading photos from PC to Iph

    Hello, I am having Iph4, recently I have started facing an issue when I upload the photos from PC to my Iph. Every time when I sync my iph with my PC photos, it is shows up two albums in my Iph...one with the name of photo gallery and other with the

  • Why is it "dymasearch" comes up ONLY in Firefox - Not any of the other browzers?

    Dymasearch comes up CONSTANTLY when using the Firefox search toolbar. I'm not bothered with those weasels in any other browser. How do I solve this dilemma. God only knows how many malware and virus programs I've run - All to no avail. Thanx.

  • Problem to get message

    Hi, I do not know why I still get the message written to the file, using such codes if (!Directory.Exists(@"c://AB_Position_List//P03RPR-DP03R_0722.txt")) sw.WriteLine("File 'P03RPR-DP03R_0722.txt' does not exist!"); return; while the file does exist

  • Stuck on adding a new layer

    I am using the trial version of cs6 and when ever I trie to add a second layer for text it throws me back to the first layer.. I have committed changes before I thy to work on the new layer..what am I doing wrong?