Info abt  jpeg Encoder

hi
i'm doing some image processing and i want to save tht processed image in mobile memory.I think to retrieve the processed image after storing needs some encoding format is there any jpeg encoder available or else v've have write our own encoder.
and also is it possible to change the encoder in core java to j2me
thanx in advance

Hi nitin
Manual accurals - you can post accurals manually in two scenarios when you are going to pay for lumpsum amount and when you are going for accurals correction
when you enter the amount manually in VBo2 then a credit memo request is created . but these are not posted to FI as these are manual accurals and manual payments
Manual payments - When you click on the payment data tab in VBo2 then you can  enter the value and the accural amount partially or fully and when you save a credit memo request is created . then you can do the billing and that accural amount is passed to FI
Regards
Srinath

Similar Messages

  • Where can i get info abt deadlocks

    Hi ,
    I want to get some info abt dead locks and when it happen.I have one scenario where 4-5 process writing to the same table at the same time.I want to find out how the process is gng to effect if i ncrease parallel processes.
    Thanks
    Anand

    Based on the above mentioned commands, it looks like it's just going to block the rows forever. Try the following
    1)Open two sessions of SQL Plus. Let's call them S1 and S2
    2)Run the following using S1
    CREATE TABLE DTEST (ID INT,NAME VARCHAR2(400));
    INSERT INTO DTEST (ID,NAME) VALUES (1,'NAME1');
    INSERT INTO DTEST (ID,NAME) VALUES (2,'NAME2');
    COMMIT;
    And then these
    S1: UPDATE DTEST SET NAME='NAME3' WHERE ID = 1;
    S2 : UPDATE DTEST SET NAME='NAME4' WHERE ID = 2;
    S1: UPDATE DTEST SET NAME='NAME4' WHERE ID = 2;
    S2: UPDATE DTEST SET NAME='NAME3' WHERE ID = 1;
    (While running the above mentioned commands,
    DBA_BLOCKERS, DBA_WAITERS views can be used to view the locks being held ofcourse
    by using separate sessions than the above mentioned ones)
    A deadlock will occur with the following error message
    ERROR at line 1:
    ORA-00060: deadlock detected while waiting for resource
    Hope this helps
    Regards

  • Problems when jpeg encoding multiple images

    Hi, im trying to write a servlet which generates multiple thumbs. However when encoding for the second time i get an error java.io.IOException: reading encoded JPEG Stream.
    I can't figure out the problem
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.awt.Image;
    import java.awt.Graphics2D;
    import java.awt.geom.AffineTransform;
    import java.awt.image.BufferedImage;
    import javax.swing.ImageIcon;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    public class Thumbs extends HttpServlet {
      private String dbDriver = "com.mysql.jdbc.Driver";
      private String dbURL = "jdbc:mysql://localhost/shopper?";
      private String userID = "javauser";
      private String passwd = "javadude";
      private Connection dbConnection;
      //Initialize global variables
      public void init() throws ServletException {
      //Process the HTTP Get request
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try{
          String foreignNr = request.getParameterValues("p")[0];
          String maxDim = request.getParameterValues("s")[0];
          if (foreignNr != null){
            int foreignID = Integer.parseInt(foreignNr);
            int maxDimension = Integer.parseInt(maxDim);
            response.setContentType("image/jpeg");
            OutputStream out = response.getOutputStream();
            writeThumbnailPictures(out,foreignID,maxDimension);
        } catch (Exception ex){
            log(ex.getMessage());
      public void writeThumbnailPictures(OutputStream out,int foreignID,int maxDimension){
        try{
          Class.forName(dbDriver);
          dbConnection = DriverManager.getConnection(dbURL, userID, passwd);
          PreparedStatement pageStatement;
          pageStatement = dbConnection.prepareStatement(
              "select * from pictures where ForeignID = ?");
          pageStatement.setInt(1, foreignID);
          ResultSet recs = pageStatement.executeQuery();
          while (recs.next()) {
            byte[] data = recs.getBytes("Picture");
            if (data != null) {
              Image inImage = new ImageIcon(data).getImage();
              // Determine the scale.
               double scale = (double)maxDimension / (double)inImage.getHeight(null);
               if (inImage.getWidth(null) > inImage.getHeight(null)) {
                   scale = (double)maxDimension /(double)inImage.getWidth(null);
               // Determine size of new image.
               // One of them should equal maxDim.
               int scaledW = (int)(scale*inImage.getWidth(null));
               int scaledH = (int)(scale*inImage.getHeight(null));
               // Create an image buffer in
               //which to paint on.
               BufferedImage outImage = new BufferedImage(scaledW, scaledH,
                   BufferedImage.TYPE_INT_RGB);
               // Set the scale.
               AffineTransform tx = new AffineTransform();
               // If the image is smaller than
               // the desired image size,
               // don't bother scaling.
               if (scale < 1.0d) {
                   tx.scale(scale, scale);
               // Paint image.
               Graphics2D g2d = outImage.createGraphics();
               g2d.drawImage(inImage, tx, null);
               g2d.dispose();
               // JPEG-encode the image
               JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
               encoder.encode(outImage);
          out.close();
        catch(Exception ex){
          ex.printStackTrace();
      //Clean up resources
      public void destroy() {
    }

    Hi,
    I am facing same problem while generating the thumbs. Did you figure out what the problem is? if you have the solution, do post it.
    Thanks in advance
    Mo

  • Jpeg encoding

    Hi
    I wondered if someone could help.
    I am working on an app that allows people to manipulate
    images and have them passed to the server to be sent or stored. I
    have all the basics working here and the jpeg encoded data being
    passed to the server etc. All works well.
    However, my next hurdle is how to pass multiple encoded files
    in what shot? As the user can say have 5 images that they can make
    in one session, to create a simple animation. Is there a way of
    packaging multiple bytearrays up and for php to sort them out on
    the server?
    I avent had much experience with byte arrays so any pointers
    would be great.
    regards
    ade

    the jdk library is open source. did you look for the jpeg encoder?
    package com.sun.image.codec.jpeg

  • Problems with JPEG encoding

    I'm making photo album on the web. But I have a problem with thumbnails generation. I have read alot about it on this forum (thanks guys) but I have a problem:
    Sometimes (but not every time) and independent on the image I've got thumbnail picture that can not be readed neither by IE or Photoshop or another programm. I'm using next encoding sequence:
    PEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    com.sun.image.codec.jpeg.JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bufferedImage);
    writeParam.setCompressionMode(JPEGImageWriteParam.MODE_EXPLICIT);
    param.setQuality(0.7f, true);
    encoder.setJPEGEncodeParam(param);
    encoder.encode(bufferedImage);
    And this code operate in the Servlet enviroment. So, I can not understand what is wrong?
    Renat.

    Hi Renat.
    I may be wrong but I have observed some troubles with JPEG encoding (particularly because of a lack of CPU)... You may have the same trouble... The problem is that I don't how to catch these errors but if someone knows how to, I would be really interested in... I can only catch them when I decode these images thanks to TruncatedFileException and ImageFormatException.
    Stephane.

  • Jpeg Encoding Problem

    Hello,
    I have an applet that reads a data file and plots a graph. Now i'm having problem converting the graph into a jpg file using a jpeg encoder.
    I have the following snippet of code in the end.
    File file = new File("c:\\vj\\graph.jpg");
         if (file.exists()) {file.delete();}
         try {file.createNewFile();} catch (IOException eIo) {}
         try
         OutputStream out = new FileOutputStream( file );
         Image image = (Image)chart2D.createImage(chart2D.getWidth() ,chart2D.getHeight());
         Graphics g = image.getGraphics();
         chart2D.paint(g);
         BufferedImage bufImage = (BufferedImage)image;
    //     JPEGEncodeParam jep = new JPEGEncodeParam();
         JPEGImageEncoder jencoder = JPEGCodec.createJPEGEncoder(out);
         jencoder.encode(bufImage);
         out.flush();
         out.close();
         } catch (IOException e) {}
    But when i run the applet it gives me a security exception saying:
    java.security.AccessControlException: access denied (java.io.FilePermission c:\vj\graph.jpg read)
    How do i fix this problem??
    Any help would be appreciated,
    Thanks,
    Mamtha.

    Unfortunately, you can't do file I/O from an applet unless it is a signed applet. See applet security FAQ:
    http://java.sun.com/sfaq/
    If it's at all feasible, by far the simplest solution is to add a min method and make it an application instead of an applet. If it must be an applet, things get a little more complicated! Here are a couple of possibilities:
    1) You could sign your applet. For an example, see:
    http://java.sun.com/security/signExample/
    2) You can send the file to the server where the applet came from, and then have the server write it to disk. Finally, the client can request the file from the server. For an explanation and example code, see:
    http://java.sun.com/docs/books/tutorial/applet/practical/workaround.html

  • JPEG ENCODING AND DECODİNG WITH DCT TRANSFORMATION

    I NEED A JAVA SOURCE CODE JPEG ENCODING AND DECOD&#304;NG WITH DCT TRANSFORMATION ALSO QUANTIZATION. IT IS URGENT BECAUSE I WILL USE IT IN MY PROJECT AND I AM NOT GOOD AT JAVA . PLEASE I AM WAITING YOUR HELPS. MY MAIL IS [email protected] thank you very much

    I NEED A JAVA SOURCE CODE JPEG ENCODING AND DECOD�NG WITH DCT TRANSFORMATION ALSO QUANTIZATION. IT IS URGENT BECAUSE I WILL USE IT IN MY PROJECT AND I AM NOT GOOD AT JAVA . PLEASE I AM WAITING YOUR HELPS. MY MAIL IS [email protected] thank you very much

  • Jpeg encoding in headless environment PLEASE HELP

    Hello, thank you so much for anyone that might be able to help me. If I am in the wrong forum, sorry.. please tell me where I need to go (I'm new here).
    I am running a servlet (tomcat 4.01 - JRE 1.4.1) that uploads jpg images and creates thumbnails from them in a headless environment. The images are created without a problem for some amount of time and then all the images created are black (but they are the correct size). I haven't figured out what the trigger is yet. The memory seems to be ok (5 - 20MB left depending on how big the upload is). The only think I can do to make the process work correctly again is to restart the server. I have written out the image to a file before converting it and the image uploads fine... just the resized thumbnail is black. I have seen other issues like this which say to use a MediaTracker but I have 2 questions about that:
    1) I don't have a component to use for the MediaTracker because I get a HeadlessException
    2) I save the uploaded content into a byte array before converting so, I should have it already, right?
    Below is the code I am using and any help would GREATLY appreciated. I thank anyone for taking the time to read this!
    import java.awt.Image;
    import java.awt.Graphics2D;
    import java.awt.geom.AffineTransform;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.io.FileOutputStream;
    import javax.swing.ImageIcon;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    // this is the image resizine method snippet
    public void resizeImage (int maxDim, byte[] imgContent, File outputFile) throws IOException {
         Image inImage = new ImageIcon(imgContent).getImage();
         int width = inImage.getWidth(null);
         int height = inImage.getHeight(null);
         double scale = maxDim / (double) height;
         if (width > height) scale = maxDim / (double) width;
         int scaledWidth = (int)(scale * width);
         int scaledHeight = (int)(scale * height);
         BufferedImage outImage = new BufferedImage(scaledWidth, scaledHeight, BufferedImage.TYPE_INT_RGB);
         AffineTransform tx = new AffineTransform();
         // If the image is smaller than
         //the desired image size,
         // don't bother scaling.
         if (scale < 1.0d) {
              tx.scale(scale, scale);
         // Paint image.
         Graphics2D g2d = outImage.createGraphics();
         g2d.drawImage(inImage, tx, null);
         g2d.dispose();
         // JPEG-encode the image
         //and write to file.
         FileOutputStream os = null;
         try {
              os = new FileOutputStream(outputFile);
              JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
              encoder.encode(outImage);
         finally {
              os.close();
    }

    Hello, thank you so much for anyone that might be able to help me. If I am in the wrong forum, sorry.. please tell me where I need to go (I'm new here).
    I am running a servlet (tomcat 4.01 - JRE 1.4.1) that uploads jpg images and creates thumbnails from them in a headless environment. The images are created without a problem for some amount of time and then all the images created are black (but they are the correct size). I haven't figured out what the trigger is yet. The memory seems to be ok (5 - 20MB left depending on how big the upload is). The only think I can do to make the process work correctly again is to restart the server. I have written out the image to a file before converting it and the image uploads fine... just the resized thumbnail is black. I have seen other issues like this which say to use a MediaTracker but I have 2 questions about that:
    1) I don't have a component to use for the MediaTracker because I get a HeadlessException
    2) I save the uploaded content into a byte array before converting so, I should have it already, right?
    Below is the code I am using and any help would GREATLY appreciated. I thank anyone for taking the time to read this!
    import java.awt.Image;
    import java.awt.Graphics2D;
    import java.awt.geom.AffineTransform;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.io.FileOutputStream;
    import javax.swing.ImageIcon;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    // this is the image resizine method snippet
    public void resizeImage (int maxDim, byte[] imgContent, File outputFile) throws IOException {
         Image inImage = new ImageIcon(imgContent).getImage();
         int width = inImage.getWidth(null);
         int height = inImage.getHeight(null);
         double scale = maxDim / (double) height;
         if (width > height) scale = maxDim / (double) width;
         int scaledWidth = (int)(scale * width);
         int scaledHeight = (int)(scale * height);
         BufferedImage outImage = new BufferedImage(scaledWidth, scaledHeight, BufferedImage.TYPE_INT_RGB);
         AffineTransform tx = new AffineTransform();
         // If the image is smaller than
         //the desired image size,
         // don't bother scaling.
         if (scale < 1.0d) {
              tx.scale(scale, scale);
         // Paint image.
         Graphics2D g2d = outImage.createGraphics();
         g2d.drawImage(inImage, tx, null);
         g2d.dispose();
         // JPEG-encode the image
         //and write to file.
         FileOutputStream os = null;
         try {
              os = new FileOutputStream(outputFile);
              JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
              encoder.encode(outImage);
         finally {
              os.close();
    }

  • Is there a JPEG encoder for j2me, PNG,GIF and BMP encoders are also wanted.

    As is known that, image encoders are not currently available in MIDP. I have tried to port a j2se JPEG encoder to J2ME, but it cost me 32M memory when generating a 800x600 image. Could anyone help me. Thanks

    well, of course ... what did you expect?Hum, I want to do some processing on my pictures, such as rotation, and then save it or send to my friends via MMS. but it's not easy to save the processed pixels to image file, such as JPEG, GIF or PNG.

  • ImageSnapShot and Alchemy Jpeg encoder

    Hi!
    I was trying to figure out how can i use the Alchemy JPEG encoder with ImageSnapShot to capture image and encode with Alchemy encoder
    If you see the ImageSnapShot function to capture is:
         var jpg : JPEGEncoder = new JPEGEncoder();
         var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(image, 0, jpg);
    I want to capture a BIG screen, using JPEGEncoder its impossible beacose times of encoding.
    So, some can anyone that had worked with this tell me if its possible?
    Thanks in advance
    And excuse about my english =)

    I have just put up a tutorial/guide on how to use the Alchemy JPEG encoder in Flash. It's also an example on how to use a progressbar to monitor the encoding. Check out http://last.instinct.se/graphics-and-effects/using-the-fast-asynchronous-alchemy-jpeg-enco der-in-flash/640

  • How to: Hide (delete) Camera 1 and Camera 2 data in 'file info' for jpeg for email

    I want to send an email with an attached jpeg. When sending/opening the jpeg in File Info, it shows the make and model of the camera I am using. I do NOT want to include that information. Have tried different things.
    Photoshop CS3 (also tried with CS 2 and Bridge CS 2)
    Bridge CS 2
    I've set the 'preferences' in Bridge CS 2 to not show the XMP data - but I can't seem to get rid of the Camera data.
    Dual intel Mac - 10.4.1 (LOTS of ram)
    Photoshop CS3 and Bridge CS2
    tried it too with another computer:
    Dual intel Imac (extra ram)
    Photoshop CS2 and Bridge CS2
    Hope someone can help!
    Thanks

    use Save For Web

  • JPEG Encoder to GIF

    Hi I have this code, it works great except it creates JPEG's and I want to create GIFS...anyone know how????
    Cheers
        try {file.createNewFile();} catch (IOException e2) {}
        try
          OutputStream out = new FileOutputStream( file );
          Image image = s.getImage();
          BufferedImage bufImage = (BufferedImage)image;
          JPEGImageEncoder jencoder = JPEGCodec.createJPEGEncoder(out);
          jencoder.encode(bufImage);
          out.flush();
          out.close();
        catch(Exception e)
        }

    ImageIO.write( image, "gif" );
    or
    use PNGs instead.

  • How to Have file/camera info in jpeg copy

    I have a Nikon D80. If I make a picture copy in PSD, the camera info (flash, aperature, etc.) is lost.However, the XMP/IPTC info is fine. What should I do? Changing th preferences from sidecar to database didn't help. Thanks!

    mfuller52654 wrote:
    I'm using CS4. My profile contained my system info (click my name). …
    Sorry, as a long-time user of these forums, I'm not in the habit of clicking on user profiles in order to dig for information—and I'm not inclined to begin to do so now.  As a matter of fact, I have such forum "features" blocked through Firefox add-ons.  In these forums, it has been the common practice for the last decade or longer to include all pertinent data in the original post if a speedy and relevant reply is desired.  At the very least, typing in your post an indication to look in your profile would be appreciated.   I'm mentioning this hoping it might be helpful to you in the future. 
    As to your issue, I cannot replicate what you describe.  The screen shots you included mean little to me as I am not a Nikon software user, but they do give me the general idea of what data you're referencing.
    I had to dig waaaay back in order to find a JPEG from the camera, as I generally shoot raw.  I found a six-year old grab shot from a Pentax *istD DSLR to attempt to replicate your issue, and I was unable to do so.  It was the second shot generated by that camera ever, and I was just checking the camera for the first time.
    I opened the JPEG in Photoshop 11.0.2 ("CS4"), ran a quick Shadow and highlight adjustment, then did a Save As.  All pertinent data was retained (meaning all lines for which I had checked the box in Bridge preferences), as shown in the screen shots below.
    Note that Bridge shows only the data you have specified in preferences.  If that's where you have been looking, go to your Bridge Preferences > Metadata and click on the boxes corresponding to the info you want to display in that looooooong list.
    Command-Click on thumbnail for full-size image
    — Incidentally, JPEGs deteriorate every single time you save them or resave them, with no exceptions.  The image is compressed (deteriorated) for the first time in the camera when it's recorded to the card.  When you resave or "save as" later, you loose quality every single time.  That's why I don't generally touch JPEGs.  The exceptions are low-res JPEGs to illustrate a point here, usually screen shots like the one above.
    Wo Tai Lao Le
    我太老了

  • JPEG encoder quality problem

    my static method is as follow: (copy from here, and i and a setQuality Method)
    public class JPEGHandler
         public static void saveJPG(BufferedImage bi,float q,String pathname){
              String s = null;
              //BufferedImage bi = createBufferedImage(img);
              FileOutputStream out = null;
              try     {
                   File file = new File(pathname);
                   s = file.getName();
                   out = new FileOutputStream(file);
              catch (java.io.FileNotFoundException io){
                   System.out.println("File Not Found");
              catch (java.io.IOException e){
                   System.err.println(e);
                   JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
                   JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
                   param.setQuality(q, true); //Set the quality
              try {
                   encoder.encode(bi);
              catch (java.io.IOException io)
                   System.out.println("IOException");
              try{
                   out.close();
              catch (java.io.IOException io){
                   System.out.println("IOException");
              System.out.println("JPEG Saved: " + s);
    no matter i assign 0.5 or 1 to the setQuality method, the quailty and the file size of the jpg remain unchange.
    also, i have tried to set the second param of setQuailty to true and false, it dosn't help at all !!
    Anyone know how to solve it ?

    try{
         ByteArrayInputStream in=new ByteArrayInputStream(image_data);
         JPEGImageDecoder decoder =JPEGCodec.createJPEGDecoder(in,params);
         image = decoder.decodeAsBufferedImage();
         in.close();
         }catch (Exception e) {
         System.err.println("Exception "+e + " decoding "+image_name+" as JPEG");
    I've just been playing with Java 1.4 (which includes updates Graphics2D) and it fixes a number or errors I had with 1.3
    MArk

  • Jpeg encoding with imageio - pink distortion problem

    Hello, I am using the imageio classes to scale down jpg images (for thumbnails) and write them to a file. On most images, everything works perfectly. On some images, however, the resulting thumbnail image has a strange pink coloration to the whole picture. Does anyone have any ideas as to why this would happen? The code I am using is below. I thank anyone that takes the time to read this and hope someone can help.
    import java.awt.Graphics2D;
    import java.awt.geom.AffineTransform;
    import java.awt.image.AffineTransformOp;
    import java.awt.image.BufferedImage;
    import java.awt.image.IndexColorModel;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import javax.imageio.IIOImage;
    import javax.imageio.ImageIO;
    import javax.imageio.ImageTypeSpecifier;
    import javax.imageio.ImageWriteParam;
    import javax.imageio.ImageWriter;
    import javax.imageio.plugins.jpeg.JPEGImageWriteParam;
    import javax.imageio.stream.ImageOutputStream;
    public class ImageResizer
         private static final int THUMBNAIL_MAX = 120;
         private static final int SMALL_MAX = 250;
         private static final int LARGE_MAX = 575;
         private static final int LARGE_THRESHOLD = 425;
         BufferedImage inImage;
         int width;
         int height;
         private static JPEGImageWriteParam params;
         static {
              JPEGImageWriteParam params = new JPEGImageWriteParam(null);
              params.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
              params.setCompressionQuality(0.8f);
              params.setProgressiveMode(ImageWriteParam.MODE_DISABLED);
              params.setDestinationType(
                   new ImageTypeSpecifier(IndexColorModel.getRGBdefault(),
                   IndexColorModel.getRGBdefault().createCompatibleSampleModel(16,16)));
         public ImageResizer(byte[] image, long id) throws IOException
              inImage = ImageIO.read(new ByteArrayInputStream(image));
              width = inImage.getWidth(null);
              height = inImage.getHeight(null);
         public void makeSmallImage (File outputFile) throws IOException {
              resizeImage(120, outputFile);
         private void resizeImage (int maxDim, File file) throws IOException {
              double scale = maxDim / (double) height;
              if (width > height) scale = maxDim / (double) width;
              int scaledWidth = (int)(scale * width);
              int scaledHeight = (int)(scale * height);
              BufferedImage outImage = new BufferedImage(scaledWidth, scaledHeight, BufferedImage.TYPE_INT_RGB);
              AffineTransform xform = AffineTransform.getScaleInstance(scale, scale);
              AffineTransformOp op = new AffineTransformOp(xform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
              // Paint image.
              Graphics2D g2d = outImage.createGraphics();
              g2d.drawImage(inImage, op, 0, 0);
              g2d.dispose();
              // write the image out
              ImageOutputStream ios = null;
              try {
                   ios = ImageIO.createImageOutputStream(file);
                   ImageWriter writer = (ImageWriter) ImageIO.getImageWritersByFormatName("jpg").next();
                   writer.setOutput(ios);
                   writer.write(null, new IIOImage(outImage, null, null), params);
                   writer.dispose();
              catch (IOException e) {
                   System.out.println("cought IOException while writing " +
                   file.getPath());
              finally {
                   if (null != ios) ios.close();
    }

    I am having the same problem with jpegs.
    The strange thing is that this only happends with the same exact code on OS X, while it never happens on any windows machine.
    I have tried using the the ImageIO classes, and a class I got off of this board a while back; however when using this class on an OS X machine, encoding takes a really long time and gives the pink distortion.
    import java.awt.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.swing.*;
    import com.sun.image.codec.jpeg.*;
    import java.awt.event.*;
    import java.util.*;
    import java.awt.geom.*;
    public class ImageUtils {
         private static JPEGImageEncoder encoder = null;
         private static FileOutputStream fileStream = null;
         public static BufferedImage createComponentImage(Component component)
              BufferedImage image = (BufferedImage)component.createImage(component.getWidth(),component.getHeight());
              Graphics graphics = image.getGraphics();
              if(graphics != null) { component.paintAll(graphics); }
              return image;
         public static void encodeImage(BufferedImage image, File file) throws IOException
              fileStream = new FileOutputStream(file);
              JPEGEncodeParam encodeParam = JPEGCodec.getDefaultJPEGEncodeParam(image);
              encoder = JPEGCodec.createJPEGEncoder(fileStream);
              encoder.encode(image,encodeParam);
    }use it like this:
    File file = new File("ImageTest.jpg");
    image = ImageUtils.createComponentImage(imageCanvas);
    ImageUtils.encodeImage(image,file);

Maybe you are looking for

  • How do I use my WET54g with a wireless system that asks for username & password

    Hotels and other systems let you use theiur wireless for a fee.  You go onto your wireless laptop, and it automatically goes to a page where you pay and sign up (or it asks for a username and password), once that is done, you can use the network. How

  • Doubt with Iview Team Calendar

    Dear I have the following issue. The system in the iview Team Calendar is showing an employee that are not to the Organizational Unit of the Boss. The employee "Jorge" had a organizational change from 23.08.2011. In the iview Team General Information

  • How to find distinct words in Oracle Text index

    We have a requirement to fetch all distinct words in the CLOB field for all records and find the no. of records in which each word appears. DR$<Index Name>$I table stores exactly such information. Is it ok to use this table in queries? Are there any

  • Sapstartsrv.exe -application error

    Dear sir, we got SAPSTARTSRV.EXE - APPLICATION ERROR the instruction at "0x00437c52" referenced memory at "0x000000c" the memory could not be read click on ok to terminate the progrram click on cancel to debug the program error in ideas , when starti

  • Managing Mobile Devices

    We are currently in Office365 and use Intune for desktop management. Many of our users use their mobile devices to access their e-mail. We'd like to look at using Intune's Mobile Device Management capabilities but I have a question. If we were to cho