Converting a BufferedImage to an Image

I have a program with some BufferedImages that the user needs to be able to drag around the screen.
1) The dragging process is very sluggish when I use BufferedImages, but not when I use normal Images. Is this normal, or is something wrong with my program?
2) If using Images is the only way to fix this problem, how do I draw my BufferedImages into Images or convert them to Images? They have to start out as BufferedImages so that they can undergo a one-time rescaling operation.

Where can I find out what a profiler is and how to use one?
Here is an abbreviated version of the code. A non-buffered Image is available for dragging here, and it too drags sluggishly unless you eliminate the line of code that draws the BufferedImages to the screen. There is probably something else wrong with this program, because at one point dragging the BufferedImages did work well. When the problem appeared I tore my code apart trying to find out what I had messed up, but after reversing all the recent changes I had not eliminated the problem and was left mystified.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.*;
import java.awt.image.*;
import java.awt.geom.*;
public class Hanoi2 extends JFrame implements MouseListener, MouseMotionListener, ActionListener{
     private GraphicsDevice device;
     Landscape panel=new Landscape();
     JMenuBar bar=new JMenuBar();
     JMenu menu1=new JMenu("Game");
     JMenuItem m11=new JMenuItem("New Game");
     JMenuItem m12=new JMenuItem("Save Game");
     JMenuItem m13=new JMenuItem("Load Game");
     JMenuItem m14=new JMenuItem("Exit");
     JMenu menu2=new JMenu("Options");
     JMenu m21=new JMenu("Disk Number");
     JRadioButtonMenuItem sm11=new JRadioButtonMenuItem("4");
     JRadioButtonMenuItem sm12=new JRadioButtonMenuItem("5");
     JRadioButtonMenuItem sm13=new JRadioButtonMenuItem("6");
     JRadioButtonMenuItem sm14=new JRadioButtonMenuItem("7");
     JRadioButtonMenuItem sm15=new JRadioButtonMenuItem("8");
     JRadioButtonMenuItem sm16=new JRadioButtonMenuItem("9");
     JRadioButtonMenuItem sm17=new JRadioButtonMenuItem("10");
     JMenu m22=new JMenu("Disk Set");
     JRadioButtonMenuItem sm21=new JRadioButtonMenuItem("Stone");
     JRadioButtonMenuItem sm22=new JRadioButtonMenuItem("Glass");
     JRadioButtonMenuItem sm23=new JRadioButtonMenuItem("Pattern");
     JMenu m23=new JMenu("Backdrop");
     JRadioButtonMenuItem sm31=new JRadioButtonMenuItem("Spirals");
     JRadioButtonMenuItem sm32=new JRadioButtonMenuItem("Stars");
     JRadioButtonMenuItem sm33=new JRadioButtonMenuItem("Dots and Flowers");
     JRadioButtonMenuItem sm34=new JRadioButtonMenuItem("Psychedelic");
     JRadioButtonMenuItem sm35=new JRadioButtonMenuItem("Smart Sky");
     JMenu menu3=new JMenu("Help");
     JMenuItem m31=new JMenuItem("Instructions");
     JMenuItem m32=new JMenuItem("About");
     int numberdisks=4;
     int numberdisksthisgame=0;
     int diskset=0;
     int backdrop=0;
     boolean isgame=false;
     int[] diskstack={-1,-1,-1};
     int[][] poledisks=new int[3][10];
     Image[] backs=new Image[5];
     Image[][] disks=new Image[3][10];
     Image[] poles=new Image[3];
     Image cloth;
     Image company;
     Image title;
     MediaTracker tracker=new MediaTracker(this);
     int[][] diskspot=new int[2][10];
     BufferedImage[][] disksr=new BufferedImage[3][10];
     Graphics2D[][] disksg=new Graphics2D[3][10];
     BufferedImage[] polesr=new BufferedImage[3];
     Graphics2D[] polesg=new Graphics2D[3];
     boolean goer=false;
     public Hanoi2(GraphicsDevice device){
     super(device.getDefaultConfiguration());
     this.device=device;
     setTitle("Tower of Hanoi");
     setDefaultCloseOperation(EXIT_ON_CLOSE);
     title=Toolkit.getDefaultToolkit().getImage("Hanoi/Title.gif");
     company=Toolkit.getDefaultToolkit().getImage("Hanoi/Company.gif");
     cloth=Toolkit.getDefaultToolkit().getImage("Hanoi/clothspread2.gif");
     poles[0]=Toolkit.getDefaultToolkit().getImage("Hanoi/woodpole1.gif");
     poles[1]=Toolkit.getDefaultToolkit().getImage("Hanoi/woodpole2.gif");
     poles[2]=Toolkit.getDefaultToolkit().getImage("Hanoi/woodpole3.gif");
     backs[0]=Toolkit.getDefaultToolkit().getImage("Hanoi/background1.gif");
     backs[1]=Toolkit.getDefaultToolkit().getImage("Hanoi/background2.gif");
     backs[2]=Toolkit.getDefaultToolkit().getImage("Hanoi/background3.gif");
     backs[3]=Toolkit.getDefaultToolkit().getImage("Hanoi/background4.gif");
     backs[4]=Toolkit.getDefaultToolkit().getImage("Hanoi/background5.gif");
     disks[0][0]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone1.gif");
     disks[0][1]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone2.gif");
     disks[0][2]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone3.gif");
     disks[0][3]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone4.gif");
     disks[0][4]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone5.gif");
     disks[0][5]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone6.gif");
     disks[0][6]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone7.gif");
     disks[0][7]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone8.gif");
     disks[0][8]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone9.gif");
     disks[0][9]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone10.gif");
     disks[1][0]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass1.gif");
     disks[1][1]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass2.gif");
     disks[1][2]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass3.gif");
     disks[1][3]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass4.gif");
     disks[1][4]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass5.gif");
     disks[1][5]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass6.gif");
     disks[1][6]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass7.gif");
     disks[1][7]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass8.gif");
     disks[1][8]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass9.gif");
     disks[1][9]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass10.gif");
     disks[2][0]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve1.gif");
     disks[2][1]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve2.gif");
     disks[2][2]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve3.gif");
     disks[2][3]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve4.gif");
     disks[2][4]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve5.gif");
     disks[2][5]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve6.gif");
     disks[2][6]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve7.gif");
     disks[2][7]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve8.gif");
     disks[2][8]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve9.gif");
     disks[2][9]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve10.gif");
     for(int i=0; i<10; i++){
     tracker.addImage(disks[0], 0);
     tracker.addImage(disks[1][i], 0);
     tracker.addImage(disks[2][i], 0);}
     tracker.addImage(poles[0], 0);
     tracker.addImage(poles[2], 0);
     tracker.addImage(poles[1], 0);
     try{
     tracker.waitForID(0);
     }catch(Exception e){}
     tracker.addImage(title, 0);
     tracker.addImage(company, 0);
     tracker.addImage(backs[0], 0);
     tracker.addImage(backs[1], 0);
     tracker.addImage(backs[2], 0);
     tracker.addImage(backs[3], 0);
     tracker.addImage(backs[4], 0);
     tracker.addImage(cloth, 0);
     for(int i=0; i<3; i++){
     polesr[i]=new BufferedImage(11,350,BufferedImage.TYPE_INT_RGB);
     polesg[i]=polesr[i].createGraphics();}
     for(int v=0; v<3; v++){
     for(int i=0; i<10; i++){
     disksr[v][i]=new BufferedImage(65+i*15,35,BufferedImage.TYPE_INT_RGB);
     disksg[v][i]=disksr[v][i].createGraphics();
     int y=0;
     int z=-75;
     int q=0;
     for(int x=0; x<65+i*15+2; x+=2){
     if(65+i*15<81) q=7;
     if((65+i*15>80)&&(65+i*15<111)) q=6;
     if((65+i*15>110)&&(65+i*15<141)) q=4;
     if((65+i*15>140)&&(65+i*15<186)) q=3;
     if(65+i*15>185) q=2;
     if((x<(65+i*15)/8)||(x>(65+i*15)-((65+i*15)/8))) {q=q+3;}
     else if((x<(65+i*15)/4)||(x>(65+i*15)-((65+i*15)/4))) {q=q+2;}
     else if((x<(65+i*15)/3)||(x>(65+i*15)-((65+i*15)/3))) {q=q+1;}
     if(x<(65+i*15)/4) z+=q;
     if(x>=(65+i*15)/4) z-=q;
     BufferedImage bi=new BufferedImage(65+i*15,35,BufferedImage.TYPE_INT_RGB);
     BufferedImage bi2=new BufferedImage(65+i*15,35,BufferedImage.TYPE_INT_RGB);
     Graphics2D big;
     big=bi.createGraphics();
     big.drawImage(disks[v][i],0,0,this);
     RescaleOp rop = new RescaleOp(1.1f,(float)(z), null);
rop.filter(bi,bi2);
     Rectangle2D.Double rect=new Rectangle2D.Double(65+i*15-x,0,4,35);
     disksg[v][i].setClip(rect);
     disksg[v][i].drawImage(bi2,0,0,this);}
     if((v==2)&&(i==9))
     goer=true;}}
     setJMenuBar(bar);
     bar.add(menu1);
     bar.add(menu2);
     bar.add(menu3);
     menu1.add(m11);
     menu1.add(m12);
     menu1.add(m13);
     menu1.add(m14);
     menu2.add(m21);
     menu2.add(m22);
     menu2.add(m23);
     m11.addActionListener(this);
     m12.addActionListener(this);
     m13.addActionListener(this);
     m14.addActionListener(this);
     ButtonGroup group1 = new ButtonGroup();
     m21.add(sm11);
     m21.add(sm12);
     m21.add(sm13);
     m21.add(sm14);
     m21.add(sm15);
     m21.add(sm16);
     m21.add(sm17);
     group1.add(sm11);
     group1.add(sm12);
     group1.add(sm13);
     group1.add(sm14);
     group1.add(sm15);
     group1.add(sm16);
     group1.add(sm17);
     sm11.addActionListener(this);
     sm12.addActionListener(this);
     sm13.addActionListener(this);
     sm14.addActionListener(this);
     sm15.addActionListener(this);
     sm16.addActionListener(this);
     sm17.addActionListener(this);
     ButtonGroup group2 = new ButtonGroup();
     m22.add(sm21);
     m22.add(sm22);
     m22.add(sm23);
     group2.add(sm21);
     group2.add(sm22);
     group2.add(sm23);
     sm21.addActionListener(this);
     sm22.addActionListener(this);
     sm23.addActionListener(this);
     ButtonGroup group3 = new ButtonGroup();
     m23.add(sm31);
     m23.add(sm32);
     m23.add(sm33);
     m23.add(sm34);
     m23.add(sm35);
     group3.add(sm31);
     group3.add(sm32);
     group3.add(sm33);
     group3.add(sm34);
     group3.add(sm35);
     sm31.addActionListener(this);
     sm32.addActionListener(this);
     sm33.addActionListener(this);
     sm34.addActionListener(this);
     sm35.addActionListener(this);
     menu3.add(m31);
     menu3.add(m32);
     m31.addActionListener(this);
     m32.addActionListener(this);}
     int placex=0;
     int placey=0;
     class Landscape extends JPanel{
     public void paintComponent(Graphics g){
     super.paintComponent(g);
     Graphics2D g2 = (Graphics2D) g;
     try{
     tracker.waitForAll();
     }catch (InterruptedException exc){}
     if((tracker.checkAll())&&(goer==true)){
     if(isgame==false){
     g.drawImage(title,68,75,this);
     g.drawImage(company,77,250,this);}
     if(isgame==true){
     g.drawImage(backs[backdrop],0,0,this);
     g.drawImage(cloth,0,462,this);
     g.drawImage(disks[0][0],placex,placey,this);
     for(int i=0; i<10; i++){
     g2.drawImage(disksr[diskset][i],diskspot[0][i],diskspot[1][i],this);}}}}}
     public static void main(String[] args){
     try {
UIManager.setLookAndFeel(
UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) { }
     GraphicsEnvironment env = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsDevice[] devices = env.getScreenDevices();
for (int i = 0; i < 1 /* devices.length */; i++) {
Hanoi2 box = new Hanoi2(devices[i]);
box.initComponents(box.getContentPane());
box.begin();}}
     private void initComponents(Container c) {
     panel.setBackground(new java.awt.Color(201%256, 27%256, 27%256));
     panel.setPreferredSize(new Dimension(696,500));
     setContentPane(panel);}
     public void setVisible(boolean isVis) {
super.setVisible(isVis);}
     public void begin() {
     addMouseListener(this);
     addMouseMotionListener(this);
     pack();
     setVisible(true);
     setLocationRelativeTo(null);}
     public void actionPerformed(ActionEvent e) {
     if(e.getSource()==m11){
     isgame=true;
     numberdisksthisgame=numberdisks;
     for(int i=0; i<10; i++){
     diskspot[0][i]=25+(9-i)*7;
     diskspot[1][i]=462-numberdisks*35+i*35;}
     repaint();}
if(e.getSource()==m14){
     System.exit(0);}}
     boolean[] dragdisk={false,false,false,false,false,false,false,false,false,false};
     boolean[] istop={true,false,false,false,false,false,false,false,false,false};
     int xcheck=0;
     int ycheck=0;
     boolean dragother=false;
     int currentpole=0;
     public void mousePressed(MouseEvent e){
     int y=e.getY()-60;
     if(isgame==true){
     if((e.getX()>placex)&&(e.getX()<placex+65)&&(y>placey)&&(y<placey+35)){
     dragother=true;}
     for(int i=0; i<numberdisksthisgame; i++){
     if((e.getX()>diskspot[0][i])&&(e.getX()<diskspot[0][i]+(65+i*15))&&(y>diskspot[1][i])&&
     (y<diskspot[1][i]+35)){
     dragdisk[i]=true;
     xcheck=e.getX()-diskspot[0][i];
     ycheck=y-diskspot[1][i];}}}}
     boolean down=true;
     public void mouseDragged(MouseEvent e){
     int y=e.getY()-60;
     if(dragother==true){
     placex=e.getX();
     placey=y;
     repaint();}
     for(int i=0; i<numberdisksthisgame; i++){
     if((isgame==true)&&(dragdisk[i]==true)){
     diskspot[1][i]=y-ycheck;
     diskspot[0][i]=e.getX()-xcheck;
     repaint();}}}
     int currentpole2=0;
     int[] diskloca={25,250,475};
     public void mouseReleased(MouseEvent e){
     for(int i=0; i<numberdisksthisgame; i++){
     if(dragdisk[i]==true){
     dragdisk[i]=false;}}}
     public void mouseMoved(MouseEvent e){}
     public void mouseEntered(MouseEvent e){}
     public void mouseExited(MouseEvent e){}
     public void mouseClicked(MouseEvent e){}}

Similar Messages

  • Java bufferedImage to JavaFX Image

    Hi,
    is there any easy way how to convert awt bufferedImage to JavaFX Image? I am using sun's pdf-renderer which output can be AWT image which I would like to display in a JavaFX scene as a image node.

    Yes. This has already been discussed here: Image conversion between AWT and FX

  • From BufferedImage to faster Image...

    Hello all.
    I have to use JAI, Java2D, & ImageIO to read a TIFF and convert it into a transparent PNG. It results in a BufferedImage, of course. However, I noticed that the BufferedImage does not perform as quickly as the Image that can be created by the Toolkit (or obtained from the ImageIcon). This is true at least for Windows. For example, on Windows, the image is an instance of sun.awt.windows.WImage. However I have to save the image and reload it in order to get this other image
    My question is this: Is there any way to directly convert a BufferedImage to type WImage, or to whatever native Image type exists on a particular platform. Does Java provide such a mechanism? Does anyone know of a way to do this (w/o having to write and re-read the image)?
    Thank you in advance for your input.

    GraphicsConfiguration.getCompatibleImage() gives you this kind of image. Use something like
    Image originalImage = // load your image here
    BufferedImage bI = GraphicsConfiguration.getCompatibleImage();
    Graphics g = bI.getGraphics();
    g.draw(0,0,originalImage,null); // draw old image into new bI
    not sure about the exact method signatures, just what I remember.

  • How can you convert a BufferedImage into a RenderedImage?

    I'm using the Histogram class and I'm wondering how I can easily convert my BufferedImage into a RenderedImage so that I can use this class.
    Of course, if I can use my BufferedImage object with the Histogram class, please let me know =D.

    If you have Acrobat 11, you'd select: File > Save As Other > Image
    and select one of the available image formats.

  • Plz Help!!! Have to  convert an paint object to image

    Hi.I am new to Jave and am developing an application
    which has to send painted shapes(using SWING) to a mail id.
    I think it can be done in two steps
    1) Converting the paint objects to images.
    2} sending the image
    However I don't have a clue regarding the first step
    and have only a rough idea about the 2nd.
    Please suggest a solution.
    Thanks

    hi,
    you can try using the Robot call and calling the screencapture method, giving the the correct parameter values should allow it to get the image you want only, this will return a BufferedImage object, you can search the forums on how to convert a BufferedImage object to an image there are plently of examples floating around.

  • Can we control if text in a page is converted, or not, to an image?

    Hello!
    My experience tells me that if I use iWeb 1.0.1 and I put the text color with 80% opacity, for example, all text will be converted to an image. Most of the times I like this behavior, because the result is the same on every computer or browser.
    But after I update for iWeb 1.1.1 all text appears as text and no longer as images. Now, when I want some sites with the text converted to images I still use the older version (1.0.1).
    My question is: Can we control if text is converted, or not, to an image? Can we force a particular text box to be converted to an image, after 1.0.1?
    I search the iWeb forum and I have not find any answer for this particular question.
    Sorry for my english...
    Thanks!
    Power Mac G4 - 867MHz   Mac OS X (10.3.9)  

    Now answering newmacguru...
    1. Why I want text to appear as an image?
    Sometimes the graphical result is important. Most of the times, if you use a white or bright page background, what you see in iWeb is almost the same you see when browsing the page. No problem! But if the page background is black or dark, what you see when browsing the page can be different from what you see when developing the page with iWeb. And these differences can be important... Now if you tell iWeb to convert text to images, the result will be exactly the same you see in iWeb (the result you want).
    Let me show you an example. This page was published with iWeb 1.0.1. In this case all text boxes were converted to images and the result you see is exactly what I want. Normally I choose opacity of 80% in the text color to reduce the contrast between text and background (this is the graphical result I most like):
    http://clientes.netvisao.pt/3ebt2006/iweb/TesteTexto101/
    Now if you publish the page with iWeb 1.1.1/1.1.2 the result is the same for both, but different from the pages obtained with iWeb 1.0.1. I only get the result I want if the text is converted to an image (using shadow). You can also see that with a white background you get good results even if the text remains text:
    http://clientes.netvisao.pt/3ebt2006/iweb/TesteTexto111/
    http://clientes.netvisao.pt/3ebt2006/iweb/TesteTexto112/
    Thanks for the suggestion of the shadow. Sometimes using a non web safe font is not a solution, remember I want “that” graphical result...
    2. Now, considering the search engines, I think I read in this forum that the search engines can do is work, even if text is converted to images, because the text still remains in the page (sorry I don’t remember where).
    Sorry for my english...
    Power Mac G4 - 867MHz   Mac OS X (10.3.9)  

  • Is there any solution for convert document spreadsheet presentation to images with Office Web Apps?

    Hi there!
    Is there any solutions for convert document spreadsheet presentation to images with Office Web Apps?

    Hi,
    As far as I know, there is no build-in feature that convert Office file to image format in Office web app yet.
    I'll collect the information, and submit it with internal ways. Then, we could also submit the feedback here:
    http://office.microsoft.com/suggestions.aspx
    Regards,
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Trouble converting powerpoint files with png images to pdf-Can someone help?

    Hello all,
    In my line of work, I create and modify large sized posters that are created in powerpoint. I would have the files print ready by converting them to pdf. I usually have little to no issues executing this. However, I have been dealing with an issue of converting ppt files with png images. The size of the ppt is typically a 42x56 file. The several ways to convert to pdf produces an error each time. Png images are very useful as they provide much clarity vs jpegs or tiffs. The 3 ways I have tried below are:
    A) File>Print>Adobe PDF>High Quality print settings/300dpi results to an error message that says:
         "Windows cannot print due to a problem with the current print setup. Try one of the following:
         *Check the printer by printing a test page from Windows.
         *Make sure the printer is turned on and online.
         *Reinstall the printer driver"
         A blank pdf opens up (Selected to open file after publishing)
    B) File>Save as> Change file type as a pdf results in nothing happening. No pdf is produced.
    C) Acrobat>Create PDF results to an error message that says: "An unexpected error occured. PDFMaker was unable to produce the Adobe PDF."
    Again, this all happens with ppt files with png images. I took out the png images and attempted to convert to pdf, and the pdf is produced! 
    Can anyone provide any assistance in creating pdfs with png images or what settings I need to adjust? I am able to covert every other image type (jpeg, tiff, bmp), except for png images.
    I am using Microsoft Office 2010 with Adobe Acrobat X on Windows 7 (This happened on Windows XP as well).

    >I have a 48 slide presentation that has a small .png image in the "slide
    >master" so it will show up on every page.
    PowerPoint only has to store one instance of the image even thought it is
    displayed on multiple slides. But Acrobat can't do the same, the image has
    to be stored for every page that it appears on, so that would explain the
    larger file size.
    Acrobat is supposed to be able to optimize the storage of common background
    images (at least that's the message I see when I do a "Save as..."), but I
    have yet to see it to work. Maybe it depends on the application the orginal
    file is created in and the PDF conversion method used.
    Adding the image into a PDF file later as a watermark instead may be a way
    to keep the size down (then it really only does store the object once),
    though I believe that watermark images will appear in front of everything
    else on the page (not sure if that's a problem for you, it depends on
    whether any text or objects in the presentation ever appear in front of the
    image).
    What are the dimensions and resolution of the image in PowerPoint? You may
    be able to go as low as 75 dpi and not notice a difference, it depends on
    whether the image contains any areas of high contrast or text.

  • How to convert base64 data to an image

    Hello, my enterprise application is receiving base64 enocoded image data in an xml file. Now I need to convert it to a native image formats like jpeg/jpg/tiff/pdf etc. Does anybody know if there are any Java apis (both free/paid) which let you do this. Actually I would not have any idea of what type of image it was when it was initially encoded to base64 format. I am looking for an API/technique that can convert base64 data to any image depending on what I want at runtime.
    Thanks a lot in advance.
    R

    Hi there,
    I've had to deal with exactly the same problem myself. The images I had to deal with were all TIFF files, and that was okay, I'd say one of your first steps would be to find out what format these images are in.
    I used a SAX Content Handler to pull the base 64 image data out of the XML into a String, and then converted the Base 64 String into a byte array. From there I could either simply write the byte array to a file, or if I wanted use ImageIO to create an Image object, work with the metadata or even save it in a different format, though I never actually did that.
    Anyway, here is some code I whipped up to convert the String to a byte array, then write the byte array to disk. Let us know how you get along!
          * Writes a byte array to a file.
          * @param result          String containing base64 image data     
          * @param fileName     File name to write the converted image to
         public static void writeTiff(byte[] result, String fileName) throws IOException {          
              FileOutputStream out = new FileOutputStream(fileName, true);
              out.write(result);
              out.close();
          * Converts a String of base 64 image data, captured from XML, into a byte array.
          * @param      image     A Base 64 String          
          * @return      byte[]          
         public static byte[] convertTiff(String image) throws IOException {          
              byte[] result = new sun.misc.BASE64Decoder().decodeBuffer(image);
              return result;
         }

  • Using QuickTime Pro to convert a series of JPEG images into a QT movie?

    Can I use QuickTime Pro to convert a series of JPEG images into a QT (uncompressed) movie? Thanks...
      Windows XP  

    Yes.
    One of the features of the QuickTime Pro upgrade is "Open Image Sequence". It imports your sequencially named (1.jpg, 2.jpg) liked sized images (any format that QT understands) and allows you to set a frame rate.
    http://www.apple.com/quicktime/tutorials/slideshow.html
    You can also adjust the frame rate by adding your image .mov file to any audio clip. Simply "copy" (Command-A to select all and then Command-C to copy) and switch to your audio track.
    Select all and "Add to Selection & Scale". Open the Movie Properties window and "Extract" your new (longer or shorter) file and Save As.
    As you've posted in the Mac Discussion pages but your profile says XP you'll need to subsitute Control key where I reference Command key.

  • I want to convert pictures to 1 bit image

    dir sir;
    i want to make a programe by it i want to upload image real image and then it converted it for 1 bit image ;
    can i use java to do that?
    and if soo what method and package and function helps me to do that .
    if you can provide me with simple code i will be thankfull.
    beast regards.

    Hi,
    if you have vision, you could use the functin IMAQ Image to Array to have a 2D array of the pixel values.
    You can then compare pixel by pixel; if your images come from a camera, I would recommend to set a treshold of acceptance.
    This is a time consuming solution anyway.
    Alternative methods:
    1) Make a subtraction of the two images, the resulting image will be the difference of them
    2 ) Use IMAQ LogDiff function (operators palette)
    3) Calculate the histogram of both image and compare the histogram reports
    Good luck,
    Alberto

  • ID ePUB export converts all *inline* anchored JPEG images to PNG?

    During ePUB export, when Image Conversion = Automatic, anchored JPEG images with Position = Inline are converted to PNG. If Anchored Object Position = Custom, the same images stay JPEG. Anyone know a better way to avoid than the less-than-ideal options below?
    Less than idea options:
    a) Use Image Conversion = JPEG (would also convert existing .gif and .png images)
    b) Specify Object Export Options for each image frame that contains a JPEG.
    Maybe this is just a bug.

    Here's the definition from the InDesign Help file:
    Image Conversion
    Lets you choose whether the optimized images in your document are converted to GIF, JPEG, or PNG. Choose Automatic to let InDesign decide which format to use in each instance. Choosing PNG disables the image compression settings; use PNG for lossless images or for images that include transparency.
    Choosing Automatic means InDesign decides which format to use. It doesn't mean keep the same format.

  • Converting canvas to an IMAQ Image in CVI

    Hi,
    I am generating a Canvas image and I would like to use Imaq Vision functions on the image. How can I pass the image from the canvas to an object of type Image?
    I need to use the canvas images as color planes to generate an RGB color image.
    Thanks,
    JHH

    JHH-
    There are two steps:
    1) Convert the canvas to an array using CanvasGetPixels, and
    2) Convert the array to an image using imaqArrayToImage
    Here is some example code for a canvas that is 320x425:
    TestImage = imaqCreateImage (IMAQ_IMAGE_RGB, 3);
    CanvasGetPixels (panel, PANEL_CANVAS, MakeRect (0, 0, 320, 425), Data);
    imaqArrayToImage (TestImage, Data, 425, 320);
    imaqDisplayImage (TestImage, 0, TRUE);
    Hope this helps-
    Dustin W.

  • How can I convert a string into an image

    I want to convert a string into an image.
    I want to know required steps for that.

    look at http://forum.java.sun.com/thread.jsp?forum=31&thread=194763
    drawString looks as something you might need

  • Converting Thumbnails to real time images

    Some how I have deleted all my photos from my Mac Air & when I recovered it, all photos turnup into thumbnail. Is their any we can convert Thumbnail into real time images?

    Thumbnails are real images but only smaller.  There's no way to up size them to get back to the size the orignals were. 
    You're best bet is to restore the library from the backup copy made just prior to this happening.
    OT

Maybe you are looking for

  • How to set the flag of the mail when I read it for POP3

    HI, All I know that POP3 does not support the flags. As per my knowledge the only flag POP3 supports is the DELETED. if i am not wrong. Now what i have to do is when i fetch the mails programmatically and once i read that I want to mark that mail as

  • Downloading adobe

    How do you download adobe flash player on the MAC? I cannot play You Tube videos without it...

  • My macbook pro 2.33 17 inch takes 9 minutes to start and does not start with lion

    my macbook pro 2.33 17 inch takes 9 minutes to start on Snow Leopard  and does not go beyond the apple log start up with lion. When I am using Snow Leopard after it has finished the starting process; everything works well..it is just the 9.10 minutes

  • Firmware update 3.0

    Hi! everybody,I reinstalled os 9 and when I restarted the computer a special note said something like « firware update 3.0 blablabla»and it stay there. Even if I try to open with the startup disk It always does the same thing. It is like a DOS writin

  • Error Code CMOD 54004

    I waited for 'live' chat for 10 minutes. I know they are busy but so am I. The code above is what I am getting when I try to use my ON DEMAND. I have menus, no playback. Tells me to unplug for 60 seconds. That fixed nothing & scrambled my info for a