Convert arrays of picture into JPEG string

Hiya, 
I have constructed a procedure to carry out some intensity analysis for my experiment.  I have chosen to use snap instead of grab, as I only need to acquire and analyse images in every 2-30 secs (low level acquisition).  I have created a time cycle for each snap shot.  However, I could not save my images, as every 30sec the process will stop and the error will occur.  At the moment, I have connected the picutre to an AVI create.vi, everytime I run the vi, an error occurs. 
I would like to save all my images into the same directory without using grab and without LABVIEW asking me the file name every time I want to save an image.  I would be the most appreciated if someone could help me with the problem please??
Attachments:
Nearlyfinishcam15.vi ‏263 KB

hello,
Maybe this is not what you want. But if you wanna a way  of saving your snaps to a directory you can do a simple thing as simple as I show you in the pic attached. You just have to but that inside a case that's true in the period that you want. And then you connect something to the "pic number" control in order to give different names for every snap.
I don't have time to analyze you .vi. But I think that it's very complicated. And worst than that it's that maybe not very well programmed and you might have some problems. You have several parts of the code that you don't garanty Dataflow. Pay attention to that.
This it's only a few ideas.
Best regards,
Software developer
www.mcm-electronics.com
PS: Don't forget to rate a good anwser ; )
Currently using Labview 2011
PORTUGAL
Attachments:
save pics.jpg ‏28 KB

Similar Messages

  • How convert to jpg picture into bmp ?

    Hi experts,
    I am trying to convert my jpg picture into bmp. for this i write one report but showing some
    TRANSFER WA_MIME1 TO DSN1.
    HERE IS MY FULL CODE PLZ HELP ME.
    REPORT  ZSE78_7.
    DATA: blob TYPE w3mimetabtype,
           blob_size TYPE w3param-cont_len,
           blob_type TYPE w3param-cont_type  .
    DATA:
         p_color_scheme      TYPE char20  ,
         p_labels_groupid    TYPE igs_label_tab,
         p_labels_category   TYPE igs_label_tab  ,
         p_data     TYPE     igs_data_tab,
         p_charttype     TYPE     char20,
         p_legend     TYPE     char20,
         l_igs_chart TYPE  REF TO cl_igs_chart ,
         l_igs_chart_engine TYPE  REF TO cl_igs_chart_engine,
         i_igs_image_converter TYPE REF TO cl_igs_image_converter,
         mime TYPE  w3mimetabtype,
         html TYPE  w3htmltabtype,
         html_line TYPE  w3html,
         l_msg_text(72) TYPE  c,
         l_url TYPE  w3url,
         l_content_length TYPE  i,
         l_content_type TYPE  w3param-cont_type,
         l_content_subtype TYPE  w3param-cont_type.
    CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
         filename                      = 'e:\katoch.jpg'
        filetype                      = 'BIN'
    *      HAS_FIELD_SEPARATOR           = ' '
    *      HEADER_LENGTH                 = 0
    *      READ_BY_LINE                  = 'X'
    *      DAT_MODE                      = ' '
    *      CODEPAGE                      = ' '
    *      IGNORE_CERR                   = ABAP_TRUE
    *      REPLACEMENT                   = '#'
    *      CHECK_BOM                     = ' '
    IMPORTING
        filelength                    = l_content_length
    *      HEADER                        =
       TABLES
         data_tab                      = mime
    EXCEPTIONS
        file_open_error               = 1
        file_read_error               = 2
        no_batch                      = 3
        gui_refuse_filetransfer       = 4
        invalid_type                  = 5
        no_authority                  = 6
        unknown_error                 = 7
        bad_data_format               = 8
        header_not_allowed            = 9
        separator_not_allowed         = 10
        header_too_long               = 11
        unknown_dp_error              = 12
        access_denied                 = 13
        dp_out_of_memory              = 14
        disk_full                     = 15
        dp_timeout                    = 16
        OTHERS                        = 17
    IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CREATE OBJECT i_igs_image_converter .
    i_igs_image_converter->input = 'image/jpeg'.
    i_igs_image_converter->output = 'image/x-ms-bmp'.
    i_igs_image_converter->width = '100'.
    i_igs_image_converter->height = '100'.
    CALL METHOD i_igs_image_converter->set_image
       EXPORTING
         blob      = mime
         blob_size = l_content_length.
    CALL METHOD i_igs_image_converter->execute
       EXCEPTIONS
         communication_error = 1
         internal_error      = 2
         external_error      = 3
         OTHERS              = 4.
    IF sy-subrc = 0.
       CALL METHOD i_igs_image_converter->get_image
         IMPORTING
           blob      = blob
           blob_size = blob_size
           blob_type = blob_type.
       DATA dsn1(20) TYPE c VALUE 'E:\test.bmp'.
    DATA wa_mime1 TYPE w3mime.
    *DATA wa_mime1 TYPE w3mimetabtype.
       OPEN DATASET  dsn1   FOR OUTPUT IN BINARY MODE.
       LOOP AT blob INTO wa_mime1.
         TRANSFER wa_mime1 TO dsn1.
         CLEAR wa_mime1.
       ENDLOOP.
    MESSAGE ' successfull' TYPE 'I'.
       CLOSE DATASET dsn1.
    ELSE.
       DATA: num TYPE i, message TYPE string.
       CALL METHOD i_igs_image_converter->get_error
         IMPORTING
           number  = num
           MESSAGE = message.
    MESSAGE 'not successfull' TYPE 'I'.
    ENDIF.

    HI
    i already converted it in binary form but when i transferring it to binary mode it generate error.
    the code is like this.
    LOOP AT blob INTO wa_mime1.
         TRANSFER wa_mime1 TO dsn1.
         CLEAR wa_mime1.
       ENDLOOP.
       CLOSE DATASET dsn1.

  • Converting a Labview time into a string with Measurement Studio C++

    In my Measurement Studio-based C++ application, I'll be sent a Labview
    time in the format of a double, which I believe is seconds since 1904.
    Does Measurement Studio for Visual C++ contain a function that will
    convert that time value into a string format? I'd like to end up with
    something like "hh:mm:ss:msec". I'm basically looking for the
    equivalent of the Labview vi, "Format Time/Date String". If Measurement
    Studio doesn't provide this, is there some other (hopefully simple) way
    to do this?
    I can request that the Labview application send me time in a string
    format as well as a double; this will require several changes to the
    Labview application sending the timestamp, but if that is a simpler
    solution that's the option we'll take.
    Thanks in advance,
    Adam

    Measurement Studio does not have a function for this, but you can do
    this yourself by first converting from LV epoch (1/1/1904) to Unix
    epoch(1/1/1970) and then using c runtime time functions
    UNIXEpochOffset is the difference between the 2 epochs at GMT. To
    convert to a UNIX system clock value, just subtract the sum of this
    number and your time zone offset in seconds
    lvTime is the value returned by LV timestamp
    #define  UNIXEpochOffset 2082844800
    int _tmain(int argc, _TCHAR* argv[])
        __int64 lvTime = 3214396284; //10:48:13.173 AM 11/9/2005
        //GMT offset for Central Time is -6 (3600 seconds). You will need to account for daylight savings time.
        int offset = -3600;
        time_t unixTime = lvTime - UNIXEpochOffset - offset;  
        struct tm *newtime = localtime(&unixTime);
        printf(asctime( newtime )); //prints out the time in a string format.
        return 0;
    Bilal Durrani
    NI

  • Slow to convert Oracle 11g XMLType into Java String or Document

    After retrieving a result set from an Oracle 11g database, it takes roughly 75 seconds to convert the XMLType (this is a structured XML Storage, registered with an xsd) into either a java String or Document. I'm using Java 1.6, have the xdb.jar and xmlparserv2.jar
    This xsd is <100 lines and the xml document is also <100 lines.
    Sample code:
    oracle.xdb.XMLType xml = oracle.xdb.XMLType.createXML((oracle.sql.OPAQUE)rset.getObject("XMLDATA"));
    the other way, but still took just as long:
    XMLType xml = (XMLType)rset.getObject("XMLDATA");
    xml.getStringVal();
    or
    org.w3c.dom.Document doc = xml.getDocument();
    either way of the above ways takes just as long.

    If I put this value into the database table, I can
    see only the date. Time part is missing. Is this the
    problem with java.sql.Date or Oracle datatype Date?This is not a problem, this is the defined behaviour of the Date type. RTFAPI and have a look at Timestamp, while you're at it.

  • How to Convert array of int into array of byte - please help

    I have a 2-dim array of type int and I want to convert it to an array
    of byte. How can I do that? Also, if my 2-dim int array is one dimention
    can I use typecast as in the example below?
    private byte[] getData()
    byte []buff;
    int []data = new int[5];
    //populate data[]
    buff = (byte[]) data; <---- CAN I DO THIS??????
    return buff;

    hi, I suggest you make an array of byte arrays
    --> Byte[][] and use one row for each number
    you can do 2 things,
    take each cipher of one number and put one by one in each column of the row correspondent to that number. of course it may take too much room if the int[] is too big, but that is the easiest way I think
    the other way is dividing your number into bitsets(class BitSet) with sizes of 8 bits and then you can save each bit into each column of your array. and you still have one number in each row. To put your numbers back use the same class.
    Maybe someone has an easier way, I couldnt think of any.

  • Converting a text file into a String

    I need to convert a text file (in whatever format, in my case it would be xml and xsl files) in a String.
    I made this methods:
    public static String createStringFromFile(File f) {
            StringBuffer buf = new StringBuffer();
            try {
                FileInputStream fInp = new FileInputStream(f);
                byte[] byteArray = new byte[fInp.available()];
                int bLetti = fInp.read(byteArray);  
                if (bLetti == fInp.available()) {
                    for (int i=0; i<fInp.available(); i++)
                        buf.append(Byte.toString(byteArray));
    else
    throw (new IOException("Errore nella lettura del file"));
    fInp.close();
    } catch (Exception e) {
    ErrorManager.getError(e);
    return (buf.toString());
    public static String createStringFromFile(String fileName) {
    StringBuffer buf = new StringBuffer();
    try {
    FileInputStream fInp = new FileInputStream(fileName);
    byte[] byteArray = new byte[fInp.available()];
    int bLetti = fInp.read(byteArray);
    if (bLetti == fInp.available()) {
    for (int i=0; i<fInp.available(); i++)
    buf.append(Byte.toString(byteArray[i]));
    else
    throw (new IOException("Errore nella lettura del file"));
    fInp.close();
    } catch (Exception e) {
    ErrorManager.getError(e);
    return (buf.toString());
    There are no compilation or runtime errors, but the result string is empty. Not null, empty. What should I do? :)

    Do you really want to use bytes and so on when java does it all for you?
    Here's how I did it, hope it's useful.
    public String getFileAsString(String fileName){
         StringBuffer buffer = new StringBuffer();
         try{
         BufferedReader bRead = new BufferedReader(new FileReader(new File(fileName)));
         String str = "";
         while( (str = bRead.readLine()) != null ){
              buffer.append(str);
         }//end while
         bRead.close();
         }catch(Exception e){
         System.err.println("in getFileAsString(): " + e.toString());
         }//end try
         return buffer.toString();
    }//end getAsString()

  • No matter what i do i cannot convert my .cr2 files into .jpeg, It pops up with a message saying this isnt the right type of document, does anybody know what to do?

    I have tried different plugins and every guide to fix it and I cannot fix it, any suggestions?

    EOS 30D
    CR2
    3.4
    ACR 3.4 or later is required for you camera or you need to create dng files for your CS2 files and process the dng files with ACR 3....

  • How can I convert IDoc in XML format w/DTD into a string?

    I want to send by e-mail outbound IDoc in XML format with its document type definition (DTD).
    I want to be able to get the same output result into a string than the XML file IDoc port type with DTD activated.  I have created a FM (based on SAP "OWN_FUNCTION") assigned to an IDoc port of type ABAP-PI that executes the following processing steps:
    1-Extract outbound IDoc information to get the sender & recipient mail addresses (EDP13 / EDIPHONE tables).
    2-Convert & Transform IDoc data into XML string using FM IDX_IDOC_TO_XML.
    3-Prepare and send e-mail with XML attachement using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    I cand generate the e-mail with the XML file attachement but FM IDX_IDOC_TO_XML does not convert the IDoc with proper formating and DTD.
    What should I use to accomplish the IDoc conversion to XML w/DTD into a string?
    Should I use XSLT tools ?
    How does that work?
    Thank you
    Carl

    muks wrote:
    Use decimal string to number
    Specifically, you can define a constant with a different datatype on the input on the lower left if you need a different datatype (e.g. U8, I64, DBL, etc) Are all your values integers or do you also need to scan fractional numbers? In this case, you should use "fract/exp string to number" instead.
    LabVIEW Champion . Do more with less code and in less time .

  • How to convert hex into a string value

    hei evryone!
    can anyone please help me on how to convert a hex value into a string suppose.. Example i want to convert 4275646479 which is a hex value, into a string "BUDDY"? how will i do that???
    Any suggestion, tutorial site would be appreciated?
    Thx!

    something like this will convert string to byte[]
    e.g.
    you want to convert following.
    656667 => ABC
    String toConvert = "656667";
    byte[] returnVal = String2byteArr (toConvert );
    String FinalStr = new String(returnVal);
    public static byte[] String2byteArr(String Result)
    byte[] byteRet = new byte[Result.length()/2];
    int k=0;
    for (int j=0; j<(Result.length()); j+=2)
    try
    Integer I = new Integer (0);
    I = I.decode ("0x"+Result.substring(j, j+2));
    int i = I.intValue ();
    if (i > 127)
    i = i - 256;
    byteRet[k++] = new Integer(i).byteValue();
    catch(Exception e)
    System.err.println(e);
    return byteRet;
    }// String2byteArr
    Hope this will help you, So that i can get 3$ (:-)
    Avi

  • Convert an Object into a String

    Good day to everyone. I am trying to do a little coding in which a user will input his desired username. I want to check the database if the desired username of the current user is existing, so there'll be no duplication. I'm using JPA for the model and JSF for the controller and view.
    Here's my Model.
    @Entity
    public class WebUser implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        private String lastName;
        private String firstName;
        private String middleName;
        private String username;
        private String password;
        public Long getId() {
            return id;
        public void setId(Long id) {
            this.id = id;
        @Override
        public int hashCode() {
            int hash = 0;
            hash += (id != null ? id.hashCode() : 0);
            return hash;
        @Override
        public boolean equals(Object object) {
            // TODO: Warning - this method won't work in the case the id fields are not set
            if (!(object instanceof WebUser)) {
                return false;
            WebUser other = (WebUser) object;
            if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
                return false;
            return true;
        @Override
        public String toString() {
            return "web.model.WebUser[id=" + id + "]";
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getMiddleName() {
            return middleName;
        public void setMiddleName(String middleName) {
            this.middleName = middleName;
        public String getUsername() {
            return username;
        public void setUsername(String username) {
            this.username = username;
        public String getPassword() {
            return password;
        public void setPassword(String password) {
            this.password = password;
    }The controller and jsp are auto-generated from Netbeans. My question is, how will I convert the 'WebUser' object into a String so I can compare the value from input text to the value in the database?
    Here is my validation method inside WebUserController.java
    public void validateUsername(FacesContext facesContext, UIComponent component, Object value) throws ValidatorException {
            String newUsername = (String) value;
            System.out.println("new user name: " +newUsername);
            System.out.println("component: " +component);
            int webUserSize;
            StringBuffer sb = new StringBuffer();
            //webUsers.toString();
            if ((webUsers == null) || (webUsers != null)) {
                System.out.println("web users null");
                List<WebUser> allWebUsers = getWebUsers();
                webUserSize = allWebUsers.size();
                System.out.println("all web users: " +allWebUsers);
                System.out.println("size " +webUserSize);
                for(int i=1; i<=webUserSize; ++i) {
                    sb.append(allWebUsers);
                    System.out.println("username: " +sb.append(allWebUsers));
            }Honestly I'm new to java and having a hard time with this one. Hope someone can help me. Thanks a lot.
    I know my code is a mess. :(

    Thanks for the help guys! I used the "unique constraint" annotation of JPA and my problem is solved.
    Here's the code:
    @Entity
    @Table(
        name="WebUser",
        uniqueConstraints={@UniqueConstraint(columnNames={"username"})}
    public class WebUser implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        private String lastName;
        private String firstName;
        private String middleName;
        private String username;
        private String password;
        public Long getId() {
            return id;
        public void setId(Long id) {
            this.id = id;
        @Override
        public int hashCode() {
            int hash = 0;
            hash += (id != null ? id.hashCode() : 0);
            return hash;
        @Override
        public boolean equals(Object object) {
            // TODO: Warning - this method won't work in the case the id fields are not set
            if (!(object instanceof WebUser)) {
                return false;
            WebUser other = (WebUser) object;
            if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
                return false;
            return true;
        @Override
        public String toString() {
            //return "web.model.WebUser[id=" + id + "]";
            return "web.model.User[username=" + username +"]";
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getMiddleName() {
            return middleName;
        public void setMiddleName(String middleName) {
            this.middleName = middleName;
        public String getUsername() {
            return username;
        public void setUsername(String username) {
            this.username = username;
        public String getPassword() {
            return password;
        public void setPassword(String password) {
            this.password = password;
    }Thanks again guys!

  • How to convert XMP files into JPEG ones?

    I need to convert 16 xmp files into jpeg or tiff ones.

    XMP files are metadata files, so you are wanting to print out the text metadata associated with these 16 images? You will usually see them once a raw file (like NEF or CRW) is processed through Adobe Camera Raw. XMP files are not images.

  • Change an myArray[] into a String

    Hi all,
    i was just wondering if there is a way to change an int[] array called myArray[] into a String to be printed out in the command prompt? i have been using a for loop to run through each index of myArray[] and print it out, but i thought that there must be a way to convert the int[] array into a string and print all the elements out at once. i want to avoid the loop, is it possible?
    Thanks
    Jay

    Hi all,
    i was just wondering if there is a way to change an
    int[] array called myArray[] into a String to be
    printed out in the command prompt? i have been using
    a for loop to run through each index of myArray[] and
    print it out, but i thought that there must be a way
    to convert the int[] array into a string and print
    all the elements out at once. i want to avoid the
    loop, is it possible?
    Thanks
    JayJay,
    An Array in java is an object, not a primitive, and inherits the toString() method from Object, which prints the object reference. Do you have to use an array? If you use Vector, which implements a growable array, you can take advantage of the fact that Vector has a redefined toString() method which prints the elements of the Vector.
    For example:
    Vector myIntVector = new Vector();
    myIntVector.add( 1 );
    myIntVector.add( 2 );
    myIntVector.add( 3 );
    System.out.println( myIntVector );will print
    [1, 2, 3]

  • Batch Psd image conversion into jpegs in pse 10 or 11?

    I want to batch convert some .psd images  into jpegs in pse 10 or 11. I know you can batch convert for image resizing,but don"t see the ability to convert images from one format into another.  Thanks!!

    Unfortunately, you have posted to the Photoshopn (PsE's big-brother) General Discussions Forum. There is a very good, and active Ps Elements Forum, where your question will be answered. I will Move your thread to the Ps Elements Forum, and your link, plus any e-mail subscriptions will follow.
    Good luck,
    Hunt
    [Moved to Photoshop Elements Forum]

  • Can "jpeg+raw" imported single file be split into jpeg and raw files?

    I manage to choose to import my jpeg and raw pictures as single jpeg+raw files accidentely. What means with this format? can I split this "jpeg+raw" pictures into jpeg and raw again? If you edit a jpeg+raw picture are you just working with the raw file, I mean I saw that I could change the exposure on the file which you only can do on raw files. Is it a bad idea to import jpeg and raw pictures as a single file? I really don´t understand the properties of this "jpeg+raw"-file
    /Magnus Lightroom rookie

    With RAW+JPEG, the JPEG is only used for the initial Library view, prior to generating previews from the RAW file. Once you have generated previews and/or developed the image, the JPEG is unused. The edits you make won't affect the JPEG at all. It is, however, still tied to the RAW as metadata, so deleting the JPEG will flag your image as having problems (and list it as "missing" even though it's very clearly in your catalog). Tuning off the option to handle RAW+JPEG together in preferences won't fix past combo images, but it will avoid making this idiotic mistake in the future. After turning it off, export your metadata to the RAWs, then delete them from the library (not the disk) and then reimport them without the JPEGs. Peace will rule the world.

  • How to convert an array of Integers into String

    So how can an array of integers be converted into a string?
    As I do not have a javac with me now, I hope you guys could help.
    Can it be done this way:
    int [] value = new int[] {2,3,4,5,6,7}
    String strValue = "";
    for (i=0; i<value.length-1; i++)
    strValue += value;

    Instead of working with Strings, I would suggest you use a StringBuffer. It will improve memory utilization.
    Like this:
    int [] values = new int[] {2,3,4,5,6,7};
    StringBuffer sbTmp = new StringBuffer();
    final int size = values.length;
    for (i = 0; i < size; i++) {
    String intStr = Integer.toString(values);
    sbTmp.append(intStr);
    String strValues = sbTmp.toString();

Maybe you are looking for