Save 16 bit array as image

Hello,
I am a new labview user. I am trying to save an image which is being
correctly displayed on the front panel of my program as an intensity
graph. I  am able to get a 2D array of the pixel values (using the
variant to data function, the camera I use has an Active X interface
with labview). The camera allows 16 bit or 12 bit digitization options.
I would like to save the image pizel values as a 16 bit BMP or TIFF
file. However, from what I understand, the flatten pixmap option in
labview does not support 16 bit images. How do I go about saving my
images? Any feedback would be extremely useful.
Thanks,
Sanhita

Hello,
have a look at this example and tell me if it works as you expect
hope this helps
Message Edité par TiTou le 07-07-2006 12:33 PM
When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
Attachments:
image.vi ‏106 KB

Similar Messages

  • How to save Byte Array of raw data into JPEG image.

    Hello!
    I have a image and I stored its data as byte array as
    bimage = bitmap1.getRawData();
    now I have Byte[] bimage, I want to save it as .jpeg image.
    and show that image..............

    the short way is this:
    ImageIO.write(bimage, "jpeg", new File("image.jpg"));
    Where you use the original Image object... but it has to be a java.awt.image.RenderedImage (which a java.awt.image.BufferedImage is). So this method would come in handy.
         public static BufferedImage getBufferedImage(Image img) {
              // if the image is already a BufferedImage, cast and return it
              if((img instanceof BufferedImage) && background == null) {
                   return (BufferedImage)img;
              // otherwise, create a new BufferedImage and draw the original
              // image on it
              int w = img.getWidth(null);
              int h = img.getHeight(null);
              BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
              Graphics2D g2d = bi.createGraphics();
              g2d.drawImage(img, 0, 0, w, h, null);
              g2d.dispose();
              return bi;
         }If the byte array you have is raw image data, then you can look at the javax.imageio package and see what you can do with those classes.

  • How can I save the 12-bits gray scale image ?

    Software & Hardware
    NI-IMAQ Vision 6.0
    NI-IMAQ for 1394 2.0.0
    Hamamatsu C4742-95
    I acqured the 12-bits gray scale image (Format7 , 640X512 size , 12bits) successfully.
    And CWIMAQViewer display the correct image of which the range is from 0(black) to 4096(white).
    But, I don't find the way to save this image with 12-bits format T.T
    Always, CWIMAQVision object save this image to 8-bit format.
    I tested all formats - tiff, bmp, aip, png.
    I think there are two possible problems.
    1. I dont't know the way to save the 12bits gray scale image. :{
    2. I dont't know the way to read the 12bits gray scale image that saved correctly.
    How can I save and load the 12-bits gray scale image ?
    What is the solution for this problem T.T ?

    Hello,
    I would recommend taking a look at the "ReadImage" Visual Basic project for more information on setting the image type and saving the image to file.  When you run the program, make sure you select 16 bit for your image.  You can also add another button to this example for saving the image.  Within the click subroutine for the button, you can add the line:
    CWIMAQVision1.WritePNGFile CWIMAQViewer1.Image, "C://image.png"
    This method will save the image in the viewer as a png file.  As long as it was loaded as a 16 bit image, it should save all of the 12 bit information into the file.  You could then test the new image by loading it using the example (you can see the pixel values by right-clicking on the viewer and selecting Settings>>Show Image Info.  The pixel value displayed in the info bar corresponds to the mouse position.
    Best Regards,
    Jesse D.
    Applications Engineering
    National Instruments

  • How can I convert an array to image(8bit)

    I can convert an array(acquire from usb camera)to a picture,but not images(8 bit grayscale),how can I do it.many thanks!
    Attachments:
    array to image.vi ‏249 KB

    Sorry, this is the kind of thing that happens when you have been out for too long.
    Message Edité par chilly charly le 10-22-2006 11:09 AM
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    array%20to%20image[1].png ‏3 KB

  • Array to Image Inconsiten​cy

    Hello, 
       I am using labview 10.0 to take images over time and then recording pixel values.  The camera I am using produces a U8 array and I have 2 methods for getting the data:
    1.  I use the labview array tools to select a subset of the U8 array and save it as a txt file.
    2.  I use the arraytoimage VI to convert the output to tiffs which I can then use another program to take line profiles of.
    In theory these two methods should give the same answer, but they don't.  I have attached a VI with the two methods and a picture of the VI comparison.  I have also attached a graph of the signal comparing the two methods.
    In theory the two curves should look the same as they are the exact same pixel, the only difference is that one is straight from the array, and the other was converted to Tiff and then reconverted to an array with Origin 8.  This makes me believe that something is messing up with the array to image conversion, or the saving to a Tiff.  I tried jpg, but that is even worse as jpg has compression.
    If anyone knows how to fix this it would be greatly appreciated.
    Attachments:
    MethodComp.vi ‏12 KB
    MethodComp.JPG ‏34 KB
    MethodCompSignal.jpg ‏1945 KB

    Are you sure that the two different calls to your get image VI are retrieving exactly the same data?
    Try using a single call and branch the data to the two different methods.

  • How to make Photoshop save Aperture imported JPEG images as JPEGs

    Recently, I upgraded from Photoshop CS 5 to CS 5.1.
    My point and shoot cameras record in JPEG format. Often, I'll import those photos into Aperture and then tweak them in Photoshop using the Edit in External Editor command. My preferences for the external editor in Aperture were set to 8-bit, Photoshop
    With Photoshop CS 5, I would edit the photo and choose Save and the edited photo would be saved back to Aperture as a new version, in a JPEG format.
    Now, using Photoshop CS 5.1, when the imported image from Aperture is converted into a PSD file and when I save back to Aperture, I end up with a PSD file.
    How can I revert to how it was before? JPEG image in Aperture, opened in external editor Photoshop as a JPEG, edited in Photoshop, then saved back to Aperture as a new version JPEG?
    (Though this question is approached in this forum, a solution to my question is never found as each dicussion ends up going off-topic from the original question)

    clapperincus wrote:
    Any further ideas from anyone who's experienced trying to open a JPEG from Aperture in Photoshop as a JPEG?
    Like I said before, you cannot open a jpeg as a jpeg, the file must be decompressed to open in PS or in Aperture, and that has always been the case.
    I do not know how it used to work, but I tested and you are correct that with PS 12.1 and with Aperture 3.2.2 a JPEG sent to open in external editor (PS) is opened into your choice of lossless format and then goes back to Aperture in the lossless format you chose.
    IMO this is the way it should be, because every save into JPEG loses image data, so such saves should be limited to the final export, in this case when the image actually leaves Aperture. If the file was compressed as a JPEG  when leaving PS, decompressed and edited in Aperture, then compressed again to export as JPEG from Aperture, unnecessary additional image data loss would occur.
    It is always better to save the application of lossy compression until the very last step in a workflow because other usages (printing, for instance) may occur before applying the lossy compression.
    -Allen

  • How do I reduce the bit depth of images to 1-bit within Acrobat 9?

    I am hoping a simple solution exists within Acrobat 9 for reducing the bit-depth of images to 1-bit.
    I know of two methods that both seem more like workarounds. One, edit the image using Photoshop. Two, without Photoshop, export the page as a 1-bit PNG and recreate the page in Acrobat. It seems like one of the preflight fixups should be able to get it done with the right settings. But, it's a labyrinth of unfamiliarity.

    There's no predefined 1-bit conversion in Preflight because it doesn't make sense. Preflight will not dither bitmaps, so most images will become black squares. Extreme color conversion is only intended for text/vector objects.
    If you want to try it anyway, you can create a custom Fixup if you have a  1-bit ICC profile.
    Preflight > Single Fixups
    Options menu > Create new Preflight Fixup
    Name it something like "Convert all to 1-bit BW"
    Search for "Convert colors" in the type of fixup box and add it
    Destination tab > Destination > your ICC profile for 1-bit black
    Uncheck "use destination from Output Intent"
    Keep everything else as default, though I'd suggest using "Embed as output intent for PDF/X" if you're making PDF/X documents
    Conversion Settings tab > All Objects + Any Color (except spot) + Convert to destination + Use rendering intent
    Press the + key to duplicate this step, and change the second copy to "Spot Color(s)"
    Press + again and change the third copy to "Registration color"
    Save the fixup and run it.
    In case you don't have a 1-bit  ICC profile installed, I've attached one.

  • RGB array to Image

    I have a MIDlet that process a image to RGB array, hear is the code:
         int[] imgRgbData = new int[width * height];
         img.getRGB( imgRgbData, 0, width, 0, 0, width, height );
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         DataOutputStream dos = new DataOutputStream( baos );
         for( int i = 0; i < imgRgbData.length; i++ )
                   dos.writeInt( imgRgbData[i] );
         byte[] imageData = baos.toByteArray();
    after that I send the RGB array to a servlet from the MIDlet, hear is the code:
         con =(HttpConnection)Connector.open("http://" + server + "/" + project + "/addReport");
         con.setRequestMethod(HttpConnection.POST);
         //con.setRequestProperty("User-agent", "Profile/MIDP-2.0 Configuration/CLDC-1.1");
         con.setRequestProperty("Content-Language", "es-ES");
         //con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
         con.setRequestProperty("Accept", "application/octet-stream");
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         DataOutputStream dos = new DataOutputStream( baos );
         dos.writeUTF(tipoReporte);
         dos.writeUTF(usuario);
         dos.writeUTF(comentario);
         dos.writeUTF(direccion);
         dos.writeInt(bin_image.length);
         dos.write(bin_image, 0, bin_image.length);
         byte[] datos = baos.toByteArray();
         con.setRequestProperty("Content-Length", "" + datos.length);
         os = con.openOutputStream();
         os.write(datos);
         os.close();
         dos.flush();
         dos.close();
    Mi problem comes I want to save to SQL Server 2005 database this array like image type using a strored procedure. Exist
    a web aplication in .NET that show this image lika jpeg. I don�t know how to pass the array to the stored procedure.
    I try with setBytes(byte[]) but the web aplication does not dsiplay the image. Then I tried to pass a existing image from my local drive using this:
         File file = new File("c:\\image.jpg");
         FileInputStream fis = new FileInputStream(file);
    and then use:
         cstmt.setBinaryStream(5, fis, (int)file.length());
    That works fine, and the .NET web aplication shows properly the image(jpeg) but I don't know how to proces the rgb array and the pass it to the stored procedure.

    To post code, use the code tags -- [code]Your Code[/code]will display asYour CodeOr use the code button above the editing area and paste your code between the tags it generates.
    db

  • Fail to index out images from an array of images!

    Hi all,
    I encountered this problem lately. I am indexing a number of images in an array using a for loop. Next the array of images (16 bit) is used somewhere else in the program; it is indexed and the images are to be processed and displayed. The problem is; when trying to index the images from the arrays using the index array the result is the same image regardless of the index!
    Can anyone explain that for me?
    Thanks in advance
    Solved!
    Go to Solution.

    When you used the IMAQ create VI you specified each image to use the same name of "image".  Each image has to have a unique name.  I edited your VI to give a unique name for each image and I was able to view three different images in three different viewing panes.
    Attachments:
    Image Array Reworked.vi ‏19 KB

  • 8 bit Array onto 10 bit Array

    Hi
       I am trying to convert a array of U8 into a 10 bits array (take the first 8 bits then add the next 2 bits of the next byte then the remaning 6 bits with the next 4 bits and so on). The ram we are using is 8bit but the
    CCD image it actually 10 bit, i have attached a couple of jpegs to show what i have done and i was wandering weather there is a expert around to say if this is the most efficient way of doing this. I have a large
    arrray to convert and would like to make it as quick as possible.
    Thanks for any help Gary
    Attachments:
    Front Panel.jpg ‏57 KB
    Block Diagram.jpg ‏56 KB

    Gary,
    Reshaping an array of bits is quite easy and (imho) the block diagram code is much easier to understand.
    For arrays of a different size you will just have to calculate the first dimension for the resize operation. 
    Regards
    Anke 
    Message Edited by AnkeS on 11-19-2008 10:16 AM
    Attachments:
    8to10.png ‏4 KB

  • How to use HorizontalList populated with an Array of Image?

    Is it possible to populate a HorizontalList with an Array of
    Image? I am trying to create a HorizontaList of Images (thumbnails)
    using a dynamic method where I put each thumbnails found into an
    Array and then indicating to the HorizontalList to use the Array as
    the dataProvider. The result is that I just see the ID generated
    for each Image.
    Since I am controlling the content of the HorizontalList into
    the mx:source, I am a bit confused how to use the itemRenderer
    property.
    Any help will be appreciated since Google don't show a lot of
    example/problems like mine at this moment!

    Hi,
    Just set the itemRenderer property to mx.controls.Image and
    you should be done.

  • Main.vi creates 2D Arrays and I want to save the arrays in an microsoft Excel file(e.g engine_1)and in differnt worksheets(e.g. measure_1;measure_2;...)

    main.vi creates 2D Arrays and I want to save the arrays in an microsoft Excel file(e.g engine_1)and in differnt worksheets(e.g. measure_1;measure_2;...)
    The path(Grundpfad)for the excel file should be inserted in the main.vi.

    1. There's a shipping example called Write Table To XL.vi (Help>Find Examples>Communicating with External Applications>ActiveX>Excel) that you can use as a starting point.
    2. Buy the LabVIEW Report Generation Toolkit. Info can be found here.
    3. Search this forum for other examples of writing to Excel.

  • Please help - I can not create large arrays of images (no more than 108 elements)

    Hello,
    I am working in an application where i acquire 300 high resolution images (3Mp) and then i process each of those frames.
    When i try to put alll those frames in one array of images, the system does not let me more than 108 elements. There is no such message like out of memory or memory error. It is just that when i visualize the array of images, there are good frames the first 108 elements, and then white frames the rest of the elements.
    Ideallically i would prefer to process frames as i am acquiring them, but i am concerned about the remaining processing time for the rest of the tasks.
    Then, as an alternative, I have tried to store frames in two shorter arrays, and i ended up observing that when the first array (say 50 elements) is full and the second array starts (another 50 elements for example), labview needs a certain time in the the middle (like three seconds between closing first array and starting acquiring on the second array). If i dont wait that time between arrays, both arrays contain the same information. I know, this is weird, and i know about the fact of passing information by reference on imaq images. 
    The most interesting thing is that when i reduce considerably the resolution of the image (say that now, instead 3Mp they are 2Mp), the maximum number of elements on the arrays are exactly the same: 108, so this makes me wonder if it is a memory constrain. And the code is fairly simple, there is no way that i am cutting the acquisition at the number 108.
    So my question is, How can i put 300 frames in one just one array? or How can eliminate the time i have to wait between arrays?
    I have heard about memory allocation and so, but i am not sure how to proceed. I have windows 7.
    Thanks in advance,
    Roberto

    It's hard to visualize.  Please post the code - or at least a shell representing your code - so we can see what is happening.  Are you sure you are getting 108 contiguous pictures, or are some aquisitions being skipped?  Is the first picture in the array the first aqcuisition?  Is the last picture the last acquisition?
    I really don't think it is about memory allocation.  I think it could be about your method of acquiring and processing said acquisitions.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • How do you make an array of image icons and then call them?

    How do you make an array of image icons and then call them, i have searched all over the internet for making an array of icons, but i have
    found nothing. Below is my attempt at making an array of icons, but i cant seem to make it work. Basically, i want the image to match the value of the roll of the dice (rollVal)
    Any help would be greatly appreciated, some code or link to tuturial, ect.
    /** DiceRoller.java
    * Roll, print, Gui
    import javax.swing.*;
    public class DiceRoller extends JFrame
         private ImageIcon[] image  ;
         public String[] images = { "empty", "dice1.jpg",
                   "dice2.jpg", "dice3.jpg", "dice4.jpg",
                   "dice5.jpg", "dice6.jpg" };
         public Dice die;
         private int rollVal;
         public int rollNum;
         private JLabel j1;
         public DiceRoller(){
              j1= new JLabel("");
           die =new Dice();
           int rollVal;
           rollVal = die.roll();     
           image = new  ImageIcon[images.length];
         for(int i = 0; i < images.length; i++){
          image[i] = new ImageIcon(images);
         if (image!=null){
              j1.setIcon(image[rollVal]);
         System.out.println("Roll = "+die.roll());

    Demo:
    import java.awt.*;
    import java.net.*;
    import javax.swing.*;
    public class IconExample {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    launch();
        static void launch() {
            try {
                Icon[] icons = new Icon[6];
                for(int i=0; i<icons.length; ++i) {
                    String url = "http://www.eureka-puzzle.be/cast/images/dice" + (i + 1) + ".jpg";
                    icons[i] = new ImageIcon(new URL(url));
                display(icons);
            } catch (MalformedURLException e) {
                throw new RuntimeException(e);
        static void display(Icon[] icons) {
            JPanel cp = new JPanel();
            for(Icon icon : icons) {
                cp.add(new JLabel(icon));
            JFrame f = new JFrame();
            f.setContentPane(cp);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • How to save a scan in Image Capture?

    How do I save my scan in image capture?
    What option to I go to save it as a JPEG or PNG to my computer?

    There's no Save command because Image Capture automatically saves scans when you click the Scan button.
    To find the format options, you have to click Show Details at the bottom. This will reveal the save location and format options, including an Overview button so you can test your crop etc. settings before you do the final scan.
    Baby Boomer (USofA) wrote:
    Image Capture>Help>Image Capture Help.
    This suggestion is not very helpful because this information is very difficult to find in the Help. Image Capture doesn't have a "Save" or "Export" command like most apps do, so anyone trying to find this info in Image Capture Help will be frustrated until they eventually dig down and discover the section "Scan images with a flatbed scanner using detailed options." In fact, if someone searches for the term "save" it doesn't even turn up any results, and "JPEG" or "PNG" only turns up results for the digital camera import part of Image Capture, nothing about scanning.
    The Apple help for Image Capture is so incomplete and counter-intuitive that this is one of those times when it's better to answer the question directly then to dump someone into the top level of Help with no guidance.

Maybe you are looking for