How can I convert OPENGL canvas graphics into bitmap image format.

I used the following code... but no conversion made... plz tell the write way..
public static void savePaintingJPG(GLCanvas canvas, String fileName) {
        // saves the content of the 'panel' in a file 'file'.jpg
        String name = "";
int framewidth = canvas.getSize().width; // get the canvas' dimensions
int frameheight = canvas.getSize().height;
System.out.println(framewidth);
System.out.println(frameheight);
  java.nio.ByteBuffer pixelsRGB = BufferUtils.newByteBuffer(framewidth * frameheight * 3); // create a ByteBuffer to hold the image data
GL gl = canvas.getGL(); // acquire our GL Object
      // read the Frame back into our ByteBuffer
gl.glReadBuffer(GL.GL_BACK);
gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1);
gl.glReadPixels(0, 0, framewidth, frameheight, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, pixelsRGB);
int[] pixelInts = new int[framewidth * frameheight*3];       // Convert RGB bytes to ARGB ints with no transparency. Flip image vertically by reading the
     // rows of pixels in the byte buffer in reverse - (0,0) is at bottom left in OpenGL.
int p = framewidth * frameheight * 3; // Points to first byte (red) in each row.
     int q;   // Index into ByteBuffer
  int i = 0;   // Index into target int[]
  int w3 = framewidth*3;    // Number of bytes in each row
  for (int row = 0; row < frameheight; row++) {
    p -= w3;
    q = p;
    for (int col = 0; col < framewidth; col++) {
      int iR = pixelsRGB.get(q++);
      int iG = pixelsRGB.get(q++);
      int iB = pixelsRGB.get(q++);
      pixelInts[i++] = 0xFF000000 | ((iR & 0x000000FF) << 16) | ((iG & 0x000000FF) << 8) | (iB & 0x000000FF);
        BufferedImage bimg = new BufferedImage(framewidth,frameheight,BufferedImage.TYPE_INT_ARGB);
          bimg.setRGB(0,0,framewidth, frameheight, pixelInts, 0, framewidth);
        try
            File imageFile = new File("final.jpg");
            File imagf = new File("final.png");
            File image = new File("final.bmp");
            ImageIO.write(bimg, "jpg", imageFile); // saves files
            ImageIO.write(bimg, "png", imagf);
            ImageIO.write(bimg, "bmp", image);
               System.out.println("Success");
        catch (IOException e) {
            e.printStackTrace();
    }

You want to convert it to an array of what? Of numbers? Of LabVIEW colors?
The "Read BMP File.vi" VI outputs a 1-D array of the pixels, but I suspect it is not exactly in the format that you need. I am NOT sure, but I think that each group of 3 elements of that 1-D array (which is inside the cluster "image data" that the VI outputs) represents the red, green and blue levels of a single pixel (but it may be hue, saturation and lum.). Also, since it is a 1-D array, you would have to divide it by the width (which is also included in the "image data" cluster) to get some sort of 2-D array of data.
You can find the "Read BMP File.vi" VI in the functions palete> "Graphics & sound">"Graphics Formats".

Similar Messages

  • How can I convert a Word document into Adobe PDF format?

    How can I convert a Word document into Adobe PDF format?

    You can use Adobe Acrobat or Adobe CreatePDF.

  • How can you convert a PDF File into a picture format for uploading?

    How can you convert a PDF File into a picture format for uploading?

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

  • How can I convert my Tiger DVD into a CD without spending more money?

    How can I convert my Tiger DVD into a CD without spending more money and time? I've spent over seven hours trying to upgrade an iMac 350 Hz OS 9.1 to Tiger. I have changed the iMac firmware to 4.1.9, but found that my Panther disc was only an OSX Upgrade, although the 3 cds are labeled as Installation Discs. Since I have a Tiger disc I thought I would use that. Unfortunately, my iMac only reads CDs, not DVDs. I tried networking the iMac to my G5, but upon shutdown, the OSX disc cannot be accessed. I copied the DVD files to my iMac hard drive, but again, the OSX disc cannot be accessed after shutdown.
    Is there a way I can burn a CD from the files of my Tiger DVD to get this task accomplished?

    Excuse me, but I never thought of that, nor did I have any intention of trying to rip off your company.
    I purchased four iPods for my family this Christmas. I have six iMacs just sitting around not being used. I thought that I would turn one into an iPod work station, so everyone can use one computer to recharge and hook up to iTunes 7.
    Unfortunately, iTunes does not work very well in OS9. Apple decided not to continue to support OS9 very well. I’ve spent several hours attempting to upgrade the iMac so I could set up iTunes 7. Unfortunately, my 3 Panther Installation Discs were mislabeled, and did not allow me to install OSX over OS9. My OSX 10.2.7 Installation Disc is a DVD, and my Tiger Installation disc is a DVD. Neither usable to update the iMac.
    All I want to do is set up a dumb iMac as a network interface to my G5 because I've use all of the G5's ports for our recording studio and the iPods need external power source if they are plugged directly into the G5.
    If you could show me an easier way to run iTunes 7 on the iMac I wouldn't be as ****** off as I am at Apple for not supporting the 9 older computers I own with usable help and upgrades.

  • How can I convert the volume directory into a single file installer?

    How can I convert the volume directory into a single file installer? I would like to hide all the miscillaneous files that I don't care for and be able to have the installer double click a single file and have it automatically install.

    On the second prompt screen when prompted 'What kind of self-extracting Zip file file do you want to make?'
    Are you choosing the second option (self-extracting Zip file for software installation)?
    I have a word file that I created to help me remember - is there anyway to email it to you?

  • How can I convert a pdf file into a usable xcel file

    how can I convert a pdf file into a xcel file. the pdf file file is layed out in colums, justified and separated in various types - i need to be able to set colum limits manualy,  thanks for your input/

    Without further information, I would suggest using either Acrobat or the Export PDF service.

  • How can I convert a pdf to a tif image?

    How can I convert a pdf to a tif image? Which software package would I need to have this capability, Adobe XI Standard, or Adobe XI pro, etc.?

    Both Standard and Pro can export to a tif file.

  • How can I convert a Microsoft Publisher document to PDF format. I have free version of Acrobat.

    How can I convert a Microsoft Publisher document to PDF format. I have free version of Acrobat.

    Hi raythree,
    I'm sorry that your PDF conversion is working. Can you please tell me if you're getting a specific error message? Knowing that can help pinpoint the cause of the conversion failure. However, here are a couple of things that you could try:
    Clear your browser cache (steps to do this vary by browser).
    If you're using a work computer, check with your IT team to confirm if you have firewall/proxy settings that restrict the ability to upload files to the Internet.
    Try another web browser.  A list of supported browsers for accessing the ExportPDF service is available here: http://www.adobe.com/acom/systemreqs/.
    Also, note that there is a 100MB file size limit, so if your publisher file is larger than that, it won't upload to ExportPDF.
    I hope this helps. But let us know if you need further assistance.
    Best,
    Sara

  • How can i convert this data(00000000) into date format(yyyy-MM-dd)

    Hi,
    i am using this method to convert date format from string.
    public static string FormatDate(string inputDate, string inputFormat)
                System.DateTime date = DateTime.ParseExact(inputDate, inputFormat, null);
                string datepresent = DateTime.Now.Date.ToString("yyyy-MM-dd");
                return datepresent;
    its working properly,
    but when input data is like 00000000 i am getting error this is not valid.
    how can i convert this into date format any help..!

    Have you tried the above code:
    I can see it is working with both Date and DateTime destination nodes.
    Map:
    Functoid Parameters:
    Functoid Script:
    public static string FormatDate(string inputDate, string inputFormat)
    string datepresent;
    if (inputDate == "00000000")
    datepresent = "0000-00-00";
    else
    System.DateTime date = DateTime.ParseExact(inputDate, inputFormat, null);
    datepresent = date.ToString("yyyy-MM-dd");
    return datepresent;
    Input:
    <ns0:InputDateString xmlns:ns0="http://DateFormat.SourceSchema">
    <DateString>00000000</DateString>
    </ns0:InputDateString>
    Output:
    <ns0:OutputDate xmlns:ns0="http://DateFormat.DestinationSchema">
    <Date>0000-00-00</Date>
    </ns0:OutputDate>
    If this answers your question please mark as answer. If this post is helpful, please vote as helpful.

  • How can i convert a .indd file into pdf

    please help on this
    How can i convert .indd file to pdf file using .net c#
    please share some code sample for a better help

    Hi there,
    There's actually an easy streamlined way to do this using Acrobat.com. Here are the steps:
    1. Log in to Acrobat.com with your Adobe ID.
    2. On the left, you'll see a navigation menu that includes the item "Import and Edit". Click that.
    3. Choose the .doc (Word) file you want to convert and upload it to Buzzword.
    4. After making sure that it looks the way you want it to, go to the top menu (still in Buzzword now, not the organizer where all your files live) and click the document menu. There will be an option to "Export" - choose that.
    5. When prompted to select filetype, choose "Adobe PDF" and press OK.
    6. It'll save to your desktop, so now you have to get it into your acrobat.com organizer. To do that, close the Buzzword document by clicking the little "x" in the upper right corner, under the Sign Out button. This'll get you back to your organizer, where you can choose "Import" from the left nav menu again. This time choose your new PDF file.
    7. Select the  file icon in the organizer and click the Share button. Or, select Share  from the file context menu.
    8. Select Allow Anyone With A  Link To Share This Document to set the document to open access, and then  click Copy Embed Code. The necessary HTML code to embed the preview is  copied onto the clipboard.
    9. Open the HTML file and paste  the code into the file. The Flash previewer can display any file type  that you can convert to PDF.
    Hope this helps! Good luck, and let us know how it works out.
    Rebecca

  • How can I convert a Pages document into PDF or RTF?

    I have been asked to send a Pages document to PC users in RTF or PDF format.  How can I get my Pages document to convert into other formats for PC people?
    Is that what the export feature is supposed to do?  I just don't know how to sent my document via e-mail to non-Apple conputers!

    You didn’t indicate whether you are using Pages ’09 v4.+ or the latest Pages v5(.2) release. To send an email with either Word or PDF attachment from within Pages:
    Pages ’09 v4+
    Pages menubar > Share (category Send via Mail) > (select Word (.doc) or PDF). Mail will launch into a compose window with the document already attached.
    Pages v5+
    Pages toolbar > Share > Send a Copy > Email > (select Word (.doc/x) or PDF - best). Mail will behave as above.
    Note: Either version of Pages is not an MS Word clone and it must translate content into the Microsoft document architecture. If you must have maximum Word document accuracy, you will need Office for Mac 2011, and the associated MS Word application that produces native .docx format.
    Backup your work.

  • How can one convert a PSD file into a RAW or DNG file?

    Lightroom does not assemble panoramas.  One must use an external editor,eg, Photoshop Elements, to construct a panorama.  Lightroom prepares the selected images by converting them to PSD files before sending them to the Elements Editor.  When the panorama is achieved, it cannot be saved as a RAW nor DNG file even if either of those formats were the original data format type in Lightroom.  Thus when the panorama is imported back into Lightroom  it is brought back as the PSD or something of your choosing; but you cannot choose a RAW nor DNG format.  The result is a folder in Lightroom with a hodge-podge of formats.    
    Question:  How can the PSD file panorama be converted into a RAW or DNG file in this transfer from an outside editor to Lightroom?

    That simply cannot be done. The conversion has to take place in order for Photoshop to create the panorama. Photoshop, by itself, without Camera Raw, cannot edit raw image data. By the time an image is opened in Photoshop is no longer raw image data. Photoshop is not capable of saving raw image data. The best thing to do is perform is much of the work as possible using using Lightroom. When I do a panorama image, I highlight all of the images and use the menu option to match total exposures. Then I do as much as possible on those images in Lightroom. Once the images leave Lightroom the raw editing is finished. Anything from that point onward that is done in Photoshop must be saved to a different file format.

  • How can I convert a word file into a pdf and then upload to a web site?

    I need to convert a word document into a pdf and then upload it to a web site so people can read it from my
    site. How can I do this? Can anyone please help? I'm only a newbie. Thanking you in anticipation.

    Hi there,
    There's actually an easy streamlined way to do this using Acrobat.com. Here are the steps:
    1. Log in to Acrobat.com with your Adobe ID.
    2. On the left, you'll see a navigation menu that includes the item "Import and Edit". Click that.
    3. Choose the .doc (Word) file you want to convert and upload it to Buzzword.
    4. After making sure that it looks the way you want it to, go to the top menu (still in Buzzword now, not the organizer where all your files live) and click the document menu. There will be an option to "Export" - choose that.
    5. When prompted to select filetype, choose "Adobe PDF" and press OK.
    6. It'll save to your desktop, so now you have to get it into your acrobat.com organizer. To do that, close the Buzzword document by clicking the little "x" in the upper right corner, under the Sign Out button. This'll get you back to your organizer, where you can choose "Import" from the left nav menu again. This time choose your new PDF file.
    7. Select the  file icon in the organizer and click the Share button. Or, select Share  from the file context menu.
    8. Select Allow Anyone With A  Link To Share This Document to set the document to open access, and then  click Copy Embed Code. The necessary HTML code to embed the preview is  copied onto the clipboard.
    9. Open the HTML file and paste  the code into the file. The Flash previewer can display any file type  that you can convert to PDF.
    Hope this helps! Good luck, and let us know how it works out.
    Rebecca

  • How can I convert a Java program into a screen saver ?

    I want to write a screen saver in Java, which is to be run under Window 95 platform. However, I don't know how to convert a .class file into a .scr file ?

    A SCR File is just an renamed exe file. So what you need is an CLASS2EXE converter (there are some around) and than simply rename the file to scr.
    Dont forget the special parameters scr files have, like /s or /c for config...look up in google for those.

  • How Can I Convert Multiple TextEdit Files Into A Single Giant File?

    For example. I have multiple chapters for my new book each saved as individual files, and I want to combine all the chapters into one single continual file that I can work with in either Text Edit or Word. How can I do this? It's hundreds of files... ∆
    Thanks!

    Hi Bruce, Tex-Edit Plus for OS X...
    http://www.tex-edit.com/
    It can Merge files then Sort them easily, even has a remove duplicate lines script available.
    If the version you get doesn't have the sort perchance, here's a link, put sort in the search scripts box, get the second one, Sort Selection...
    http://dougscripts.com/texedit/

Maybe you are looking for

  • IPhoto crashes after upgrading to '11

    Just upgraded to iPhoto '11 and it will not open. Crashes every time. I tried to rebuild libraries by holding down option Comand when opening but that didnt even appear when i tried that and just crashed again. Opened Disk Utility and repaired disk p

  • How to check whether INSO Filer is being used or not?

    Hi, We have created full text search indexes using the default syntax - CREATE INDEX FTI ON DOCUMENTS(DOC_FILE) INDEXTYPE IS CTXSYS.CONTEXT; How can I find out whether the INSO filter is used or not. Also a basic question, INSO filter helps in readin

  • Question for RDBMSAuthenticator

    Hi experts I am trying to setup RDBMSAuthenticator on my weblogic server 8.1 [not portal]. When I configured RDBMSAuthenticator on my console, then added the jar: ../p13n/lib/p13n_system.jar to my classpath. When I restarted weblogic, the following e

  • Where is speed dial on the iphone4S

    Where is speed dial on the 4S

  • Canon MP520 wont print

    Has anyone had any issues trying to get the canon MP520 printer to work? I have a windows machine which i have a canon MP520 installed and shared (USB plugged). When i search via the mac it detects the MP520 and appears to install ok. There were no d