Using image data read out from a file

Hi,
Having used the GetBitmapFromFileEx(), GetBitmapInfoEx() to acquire the necessary image data (most of them is the .png format), then using the FileToArray() to put the image data in my own binary file, e.g., "mypicture.dat". My idea is that whenever need to use the image, I can read out it from mypicture.dat and then display it on a pcture control.  But when loading the image data to the memory, I have no idea to map the image data buffer to an image resource, which can let to acquire a bitmap ID.  Because from the  cvi's image processing function lists, it seems that must through such as  the GetBitmapFromFileEx(), GetBitmapFromFile() to acquire the image data buffer and the bitmap ID, then using SetCtrlBitmap() to diplay it. Is there any way to resolve the problem? Thanks.
David 

Well, to read and write raw data file informations from a PNG image you must adhere to this standard. As a source of informations you may take a look to this Wikipedia page and to the links in this page from the PNG Home site.
So the problem is: does your application worth the effort to study this documentation?
Edit: FYI part of this job has been already made in CVI by Guillaume Dargaud for his ReadSavePNG instrument driver. It's been a long time since I have used this instrument, as I/O operations on PNG files have been integrated into CVI since release 8 and support for JPEG files in release 7 or so. Nevertheless I saw functions in that instrument for accessing raw data in a PNG file so you may find them useful for your needs.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos?

Similar Messages

  • Who worked with ICS' Model 4896 GPIB? I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    Hello. Most of the engineers in developer exchange are more familiar
    with NI products. Contacting ICS for technical support is a better
    course of action.

  • Separating a date read in from a file...

    I have a file which contains dates of birth in the form of 3 integers on each line, if I want to read in this line from the file and separate each (day,month,year), what is the easiest/best way to do this?
    The 'day' part of the date can either be stored as 1 or 2 digits depending on the date, same with the 'month', and the 'year' can either be stored as 2 digits or 4 digits. I was thinking of using substrings to get each part but obviously seeing as this is the case it would not work.
    Each part of the date is separated by a space.
    I also need to convert each part of the date to an integer.

    read in each line to a string and then use the String method split(" ") using the space as the delimiter. This will create an array of 3 strings (if there are three bits of data separated by spaces). You may have to trim these, then parse them. I'd look at the simpledateformat class as well.

  • I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    You mean an image such as a scanned document?
    If that is the case, the file doesn't contain any text for Reader Out Loud to read. In order to fix that, you would need an application such as Adobe Acrobat that does Optical Character Recognition to convert the images to actual text.
    You can also try to export the file as a Word document or something else using ExportPDF which I believe offers OCR and is cheaper than Acrobat.

  • I am facing problem while reading values from properties file ...i am getting null pointer exception earlier i was using jdeveloper10g now i am using 11g

    i am facing problem while reading values from properties file ...i am getting null pointer exception earlier i was using jdeveloper10g now i am using 11g

    hi TimoHahn,
    i am getting following exception in JDeveloper(11g release 2) Studio Edition Version 11.1.2.4.0 but it works perfectly fine in JDeveloper 10.1.2.1.0
    Root cause of ServletException.
    java.lang.NullPointerException
    at java.util.PropertyResourceBundle.handleGetObject(PropertyResourceBundle.java:136)
    at java.util.ResourceBundle.getObject(ResourceBundle.java:368)
    at java.util.ResourceBundle.getString(ResourceBundle.java:334)
    at org.rbi.cefa.master.actionclass.UserAction.execute(UserAction.java:163)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

  • How to continue to read Object from a file?

    At some program I write an object into a file. This program will be called again and again so that there are many objects which are saved to that file. And I write another program to read object from this file. I can read the first object but can not read the second. However if I delete the object in that file (using editplus, by manually) I can read the second. Because now the second object is the first object. (Delete first object).
    The exception when I read the second object is below:
    java.io.StreamCorruptedException: Type code out of range, is -84
         at java.io.ObjectInputStream.peekCode(ObjectInputStream.java:1607)
         at java.io.ObjectInputStream.refill(ObjectInputStream.java:1735)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:319)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:272)
         at LogParser.main(LogParser.java:42)
    Exception in thread "main" The read object from file program is below:
         public static void main(String[] args) throws Exception {
            FileInputStream fis = new FileInputStream(path + File.separator + "ErrorApp21config2.log");
            ObjectInputStream ois = new ObjectInputStream(fis);
            ErrorLog errorLog = (ErrorLog)ois.readObject();
            System.out.println(errorLog.getErrorDate());
            FIFData fifData = (FIFData)errorLog.getErrorDescription();
            CommRegistration commRegistration = (CommRegistration)
                                     fifData.getDataObject(FIFData.REGISTRATION_DATA);
            String ic = commRegistration.getPatient().getPatExtID();
            System.out.println(ic);
            CommQueue commQueue = (CommQueue) fifData.getDataObject(FIFData.QMS_DATA);
            String location = commQueue.getLocation();
            System.out.println(location);
            ois.readObject();  //will throw above exception
            fis.close();
         }Can anyone tell me how to continue to read object? Or I should do some special things when I write object into file?

    Thanks Jos.
    Perhaps you are correct.
    There are some code in a SessionBean to log an object. Write file code is below.
         private void logPreRegError(
              byte[] strOldFifData,
            byte[] strNewFifData,
              String requestID)
              throws TTSHException {
              if (requestID.equals(RequestConstants.ADMIT_PATIENT)){
                String runtimeProp = System.getProperty("runtimeproppath");
                FileOutputStream fos = null;
                   try {
                        fos = new FileOutputStream(
                            runtimeProp + File.separator + "Error.log", true);
                    BufferedOutputStream bos = new BufferedOutputStream(fos);
                    bos.write(strOldFifData);
                    bos.write(strNewFifData);
                    bos.flush();
                   } catch (FileNotFoundException e) {
                        log(e);
                   } catch (IOException e) {
                    log(e);
                   } finally{
                    if (fos != null){
                             try {
                                  fos.close();
                             } catch (IOException e1) {
                                  log(e1);
         }strOldFifData and strNewFifData are the byte[] of an object. Below is the code to convert object to byte[].
         private byte[] getErrorData(FIFData fifData, boolean beforeException, String requestID) {
            ErrorLog errorLog = new ErrorLog();
            errorLog.setErrorDate(new Date());
            errorLog.setErrorDescription(fifData);
            errorLog.setErrorModule("Pre Reg");
            if (beforeException){
                errorLog.setErrorSummary("RequestID = " + requestID +" Before Exception");
            }else{
                errorLog.setErrorSummary("RequestID = " + requestID +" After Exception");
              ByteArrayOutputStream baos = null;
              ObjectOutputStream oos = null;
              byte[] bytErrorLog = null;
              try {
                  baos = new ByteArrayOutputStream();
                   oos = new ObjectOutputStream(baos);
                  oos.writeObject(errorLog);
                  oos.flush();
                  bytErrorLog = baos.toByteArray();
              } catch (IOException e) {
                   log(e);
              } finally {
                if (baos != null){
                        try {
                             baos.close();
                        } catch (IOException e1) {
                             log(e1);
              return bytErrorLog;
         }I have two questions. First is currently I have got the log file generated by above code. Is there any way to continue to read object from log file?
    If can't, the second question is how to write object to file in such suitation (SessionBean) so that I can continue to read object in the future?

  • Apostroph and euro sign not read corectly from txt file

    apostroph and euro sign not read corectly from txt file.
    my code is like this:
    FileInputStream fis= new FileInputStream(x+".html");
    BufferedReader br=new BufferedReader(new InputStreamReader(fis,"UTF-8"));
    String Line="";
    while ((Line = br.readLine()) != null) result+=Line;
    br.close();
    fis.close();
    I use UTF-8 because the file contains also French characters.
    What's the problem?
    THANK YOU!

    apostroph and euro sign not read corectly from txt
    file.
    my code is like this:
    FileInputStream fis= new FileInputStream(x+".html");
    BufferedReader br=new BufferedReader(new
    InputStreamReader(fis,"UTF-8"));
    String Line="";
    while ((Line = br.readLine()) != null) result+=Line;
    br.close();
    fis.close();
    I use UTF-8 because the file contains also French
    characters.
    What's the problem?
    THANK YOU!
    This is from the FileInputStream API documentation:
    FileInputStream is meant for reading streams of raw bytes such as image data. For reading streams of characters, consider using FileReader.

  • How to read HyperLinks from pdf file??

    hi developer's,
    I am in PDF processing... I am having doubt in that Processing.
    How to read Hyperlinks from PDF file?
    I can able to set the hyperlink.. But i cant able to get the hyperlinks..
    The following example program will set the hyperlink to the PDF file using lowagie API..
    import com.lowagie.text.Anchor;
    import com.lowagie.text.Chunk;
    import com.lowagie.text.Document;
    import com.lowagie.text.DocumentException;
    import com.lowagie.text.Paragraph;
    import com.lowagie.text.html.HtmlWriter;
    import com.lowagie.text.pdf.PdfReader;
    import com.lowagie.text.pdf.PdfWriter;
    public class Argu1 {
         public static void main(String[] args) {
              Document document = new Document();
              try {
                   PdfWriter pdf = PdfWriter.getInstance(document,
                             new FileOutputStream("PageLink.pdf"));
    PdfReader pdf_read=new                
                   document.open();
                   document.add(new Paragraph("Hi Everbody....!"));
                   Anchor pdfRef = new Anchor("Click Me");
                   pdfRef.setReference("www.java2s.com");
                   Anchor rtfRef = new Anchor("Touch Me");
                   rtfRef.setReference("www.sun.com");
                   System.out.println(rtfRef.reference());
                   document.add(pdfRef);
                   document.add(Chunk.NEWLINE);
                   document.add(rtfRef);
              } catch (DocumentException de) {
                   System.err.println(de.getMessage());
              } catch (IOException ioe) {
                   System.err.println(ioe.getMessage());
              document.close();
    Help me how to read the Hyperlinks from the PDF file using java ...
    Thanks in advance,
    With Regards,
    J.Imran

    Instead of cross-posting unformatted code you could have taken a look at the API, because there you might have come across a method named getLinks...Even though it's not documented, I really suspect that it will return the Hyperlinks on a given page.

  • Read lines from a file

    With "ApartmentFileHandler" I can write Apartment-objects to a file and read them from a file.
    To write I loop through each room in the apartment and write its size
    and type. I put 1 Room per line.
    To read I read each line of the file and recreate the room stored
    there. When there are no lines left in the file I pass the Rooms from
    the file to the Apartment constructor and return the new Apartment.
    Only one Apartment is stored in each file. (Apartment doesn?t implement
    Serializable, so I cant write straight Apartment-objects to a file.)
    So in the file, there are stored one "Room" per line: String type,
    double size
    QUESTION: How am I able to read all lines: first line first -> make a new room of
    it, and store to a roomArray? Then second -> do same as I did to the
    first.
    Now my read()-method doesn't read all lines. How to change it to read next line?
    Thanks in advance.
    public class Room extends Space
    public Room(String type, double area)
    public String getType()
    public double getSize()
    public class Apartment extends Space
    public static final String KITCHEN
    public Apartment(Room[] rooms)
    public String getType()
    public double getSize()
    public Room[] getRooms()
    public class ApartmentFileHandler extends Object {
         private FileOutputStream ostream;
         private ObjectOutputStream op;
         private FileInputStream istream;
         private ObjectInputStream ip;
         private String filepath;
    public ApartmentFileHandler (String filepath) {
                              this.filepath = filepath;      
    public Apartment read()
                                      throws InvalidApartmentFile,
                                                 IOException {
          istream = new FileInputStream(filepath);
          ip = new ObjectInputStream(istream);
                                  // count how many rows in the file ie. rooms
                           String lineThatIsRead = ip.readLine();
                           int count =0;                                             
                           while (lineThatIsRead != null) {
                                    count =count +1;
                                    lineThatIsRead =ip.readLine();
         Room room;
         Room roomArray[ ] = new Room[count];
          for(int i =0; i<count; i++) {
                                  String type  =ip.readUTF();
              double size =ip.readDouble();
                                   room =new Room(type, size);
              roomArray[ i ] =room;
                                Apartment apartment = new Apartment(roomArray);
                                return apartment;
            public void write(Apartment apartment)
                  throws IOException {
                    ostream = new FileOutputStream(filepath);
                    op = new ObjectOutputStream(ostream);
                    int numberOfRooms =apartment.getRooms().length;
                    Room[] allRooms =apartment.getRooms();
                    for (int i=0; i< numberOfRooms; i++) {
                         op.writeUTF( allRooms[ i ].getType() );
                         op.writeDouble( allRooms[ i ].getSize() );
                         op.writeChars("\n");

    Hi,
    I recommend using java.io.BufferedReader in conjunction with java.io.FileReader:
    BufferedReader reader=new BufferedReader(new FileReader(filepath));
    java.io.BufferedReader provides the method public java.lang.String readLine() throws java.io.IOException which lets you read a complete line from the underlying java.io.Reader object. Furthermore, BufferedReader will - as the name implies - buffer your IO-operations which will help you improve the program's performance. In order to read all the lines contained in a text file you might want to apply a loop:
    String line;
    while((line=reader.readLine())!=null && line.length()!=0){
    //process data in string line (parse into string and double)
    Of course, everything must be contained within a try-catch-block in order to be able to handle upcoming IOException objects.
    Regards,
    Michael

  • How to load date and time from text file to oracle table through sqlloader

    hi friends
    i need you to show me what i miss to load date and time from text file to oracle table through sqlloader
    this is my data in this path (c:\external\my_data.txt)
    7369,SMITH,17-NOV-81,09:14:04,CLERK,20
    7499,ALLEN,01-MAY-81,17:06:08,SALESMAN,30
    7521,WARD,09-JUN-81,17:06:30,SALESMAN,30
    7566,JONES,02-APR-81,09:24:10,MANAGER,20
    7654,MARTIN,28-SEP-81,17:24:10,SALESMAN,30my table in database emp2
    create table emp2 (empno number,
                      ename varchar2(20),
                      hiredate date,
                      etime date,
                      ejob varchar2(20),
                      deptno number);the control file code in this path (c:\external\ctrl.ctl)
    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime, ejob, deptno)this is the error :
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 5
    C:\>any help i greatly appreciated
    thanks
    Edited by: user10947262 on May 31, 2010 9:47 AM

    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime, ejob, deptno)Try
    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime "to_date(:etime,'hh24:mi:ss')", ejob, deptno)
    this is the error :
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 5
    C:\>
    That's not an error, you can see errors within log and bad files.

  • TIFF-VIs for reading/writing from/to files

    To whom it may concern,
    I'm looking for TIFF-VIs for reading/writing from/to files
    for Labview 6 without any add-on package.
    Unfortunately I can't use TiffRd04 and TiffSv05 from
    Koji Ohashi due to the different file format!
    Any hints?
    Thank you in advance. Best regards from Germany
    Udo Weik

    Hi Udo,
    did you check these TIFF related libraries? .. maybe one of them is working.
    Good Luck

  • How can I convert/read out from a string Hex (8-bit), the bit 0 length 1

    How can I convert/read out from Hex (8-bit), the bit 0 length 1 (string subset!!??) and convert it to decimal.
    With respect to one complement and two complement ?

    Just like Jeff, purely guessing here.
    It almost sounds like you just need to Read from Binary File?
    AND the 8-bit number with 1?
    Need more details.  What exactly do you have to start with?  What exactly are you trying to get out of it?  Examples help.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Read lines from text file to java prog

    how can I read lines from input file to java prog ?
    I need to read from input text file, line after line
    10x !

    If you search in THIS forum with e.g. read lines from file, you will find answers like this one:
    Hi ! This is the answer for your query. This program prints as the output itself reading line by line.......
    import java.io.*;
    public class readfromfile
    public static void main(String a[])
    if you search in THIS forum, with e.g. read lines from text file
    try{
    BufferedReader br = new BufferedReader(new FileReader(new File("readfromfile.java")));
    while(br.readLine() != null)
    System.out.println(" line read :"+br.readLine());
    }catch(Exception e)
    e.printStackTrace();
    }

  • How can I know the length of the image data section of a PSD file

    I'm a C++ programmer developing a project to parse PSD files, and it's necessary to know whether there is a length field indicating the length of the image data in image data section of a PSD file, if not, how can I know the length?
    Thank you.

    Sorry I can't help, maybe there is some information in the SDK?
    http://www.adobe.com/devnet/photoshop/sdk.html
    Or someone might be able to help in this forum?
    http://forums.adobe.com/community/photoshop/photoshop_sdk

  • How can an image be displayed by using raw data read from the serial port?

    Hi there,
    I am using an embedded camera to take photos. To operate it i send commands to it via the serial interface. I have received all of the image data back through the serial port and can view it as hex data in a string. The image data is 16bit colour RAW data at 160x120 resolution meaning i have 38400 bytes of data (160x120 = 19200. 19200*16 = 307200. 307200/8 = 38400). I want to be able to display this data as a picture, but cannot figure out how to do it. Can someone please point me in the right direction? i have been fiddling about with lots of the pixmap functions but no luck. Do i need to put this data in to a 2D array first?

    Yes, first convert it into a 2D array of pixel values. From there you can convert it into an image to display it in a picture control.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Maybe you are looking for