How to save info in a meta-data of a jpg file?

hi, i need to know how to save info in a meta-data of a jpg file:
this is my code (doesn't work):
i get an exception,
javax.imageio.metadata.IIOInvalidTreeException: JPEGvariety and markerSequence nodes must be present
at com.sun.imageio.plugins.jpeg.JPEGMetadata.mergeNativeTree(JPEGMetadata.java:1088)
at com.sun.imageio.plugins.jpeg.JPEGMetadata.mergeTree(JPEGMetadata.java:1061)
at playaround.IIOMetaDataWriter.run(IIOMetaDataWriter.java:59)
at playaround.Main.main(Main.java:14)
package playaround;
import java.io.*;
import java.util.Iterator;
import java.util.Locale;
import javax.imageio.*;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.metadata.IIOMetadataNode;
import javax.imageio.plugins.jpeg.JPEGImageWriteParam;
import javax.imageio.stream.*;
import org.w3c.dom.*;
public class IIOMetaDataWriter {
public static void run(String[] args) throws IOException{
try {
File f = new File("C:/images.jpg");
ImageInputStream ios = ImageIO.createImageInputStream(f);
Iterator readers = ImageIO.getImageReaders(ios);
ImageReader reader = (ImageReader) readers.next();
reader.setInput(ImageIO.createImageInputStream(f));
ImageWriter writer = ImageIO.getImageWriter(reader);
writer.setOutput(ImageIO.createImageOutputStream(f));
JPEGImageWriteParam param = new JPEGImageWriteParam(Locale.getDefault());
IIOMetadata metaData = writer.getDefaultStreamMetadata(param);
String MetadataFormatName = metaData.getNativeMetadataFormatName();
IIOMetadataNode root = (IIOMetadataNode)metaData.getAsTree(MetadataFormatName);
IIOMetadataNode markerSequence = getChildNode(root, "markerSequence");
if (markerSequence == null) {
markerSequence = new IIOMetadataNode("JPEGvariety");
root.appendChild(markerSequence);
IIOMetadataNode jv = getChildNode(root, "JPEGvariety");
if (jv == null) {
jv = new IIOMetadataNode("JPEGvariety");
root.appendChild(jv);
IIOMetadataNode child = getChildNode(jv, "myNode");
if (child == null) {
child = new IIOMetadataNode("myNode");
jv.appendChild(child);
child.setAttribute("myAttName", "myAttValue");
metaData.mergeTree(MetadataFormatName, root);
catch (Throwable t){
t.printStackTrace();
protected static IIOMetadataNode getChildNode(Node n, String name) {
NodeList nodes = n.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node child = nodes.item(i);
if (name.equals(child.getNodeName())) {
return (IIOMetadataNode)child;
return null;
static void displayMetadata(Node node, int level) {
indent(level); // emit open tag
System.out.print("<" + node.getNodeName());
NamedNodeMap map = node.getAttributes();
if (map != null) { // print attribute values
int length = map.getLength();
for (int i = 0; i < length; i++) {
Node attr = map.item(i);
System.out.print(" " + attr.getNodeName() +
"=\"" + attr.getNodeValue() + "\"");
Node child = node.getFirstChild();
if (child != null) {
System.out.println(">"); // close current tag
while (child != null) { // emit child tags recursively
displayMetadata(child, level + 1);
child = child.getNextSibling();
indent(level); // emit close tag
System.out.println("</" + node.getNodeName() + ">");
} else {
System.out.println("/>");
static void indent(int level) {
for (int i = 0; i < level; i++) {
System.out.print(" ");
}

Hi,
Yes, you need store data to table, and fetch it when page is opened.
Simple way is create table with few columns and e.g. with CLOB column and then create form based on that table.
Then modify item types as you like, e.g. use HTML editor for CLOB column
Regards,
Jari

Similar Messages

  • How can I make a query by date with several TDMS files?

    Hi,
    I have a project that can write and read TDMS files everyday (a file for each day with date and time). There, I can import those files to excel (I choose a file and load it). But, I have a question: How can I make a query by date with those TDMS files? I'd like make a time stamp for start date and stop date, where I could compare the TDMS file dates and sum the values that are in the channels where these files are similar. For example, I save a file with "02/01/2013" name, in other day "03/01/2013", in other day "04/01/2013"... so, i'd like put in time stamp for start date "02/01/2013" file and to stop date "04/01/2013" file, than, sum all values that range with my TDMS files existing. How can I make that? 
    Thanks all,
    Val 

    Hello Val_Auto.
    You're Brazilian, no? Me too. = ^ - ^ =
    I converted VI to version of your LabVIEW (8.5). Is attached in this reply.
    This VI search all your TDMS in a range of dates and join them in a single TDMS. I hope this is what you wanted.
    Query TDMS is the main VI. The TDMS VI Search changes the date format that out from calendar control (which is DD / MM / YYYY) to DD-MM-YYYY. This is because you can't name files using "/". I chose "-" but, if necessary, you should change to keep the same format of your TDMS files.
    If you have any doubt as to its operation or how to make changes to adapt VI for your application, keep at your disposal.
    Thank you for your contact; I hope have helped you and succeed in your application.
    Wesley Rocha
    Application Engineer
    National Instruments Brazil
    Visite a nossa comunidade em PORTUGUÊS!!!
    Attachments:
    Query TDMS.vi ‏62 KB
    tdms search.vi ‏24 KB

  • HT2486 how can I export the contact book data to a csv file for editing?

    how can I export the contact book data to a csv file for editing?

    You can edit a card right in Contacts. No need to export and re-import.
    Select a name and on the right side, click the Edit button:

  • How do I get the last changed date & time of a file in app server?

    Hi Experts,
    How do I get the last changed date & time of a file in app server?
    Thanks!
    - Anthony -

    Hi,
    that's what I use...
      CALL 'C_DIR_READ_FINISH'.             " just to be sure
      CALL 'C_DIR_READ_START' ID 'DIR' FIELD p_path.
      IF sy-subrc <> 0.
        EXIT. "Error
      ENDIF.
      DO.
        CLEAR l_srvfil.
        CALL 'C_DIR_READ_NEXT'
          ID 'TYPE'   FIELD l_srvfil-type
          ID 'NAME'   FIELD l_srvfil-file
          ID 'LEN'    FIELD l_srvfil-size
          ID 'OWNER'  FIELD l_srvfil-owner
          ID 'MTIME'  FIELD l_mtime
          ID 'MODE'   FIELD l_srvfil-attri.
    *    l_srvfil-dir = p_path .
        IF sy-subrc = 1.
          EXIT.
        ENDIF." sy-subrc <> 0.
        PERFORM p_to_date_time_tz
          USING    l_mtime
          CHANGING l_srvfil-mod_time
                   l_srvfil-mod_date.
        TRANSLATE l_srvfil-type TO UPPER CASE.               "#EC TRANSLANG
        PERFORM translate_attribute CHANGING l_srvfil-attri.
        CHECK:
          NOT l_srvfil-file = '.',
          l_srvfil-type = 'D' OR
          l_srvfil-type = 'F' .
        APPEND l_srvfil TO lt_srvfil.
      ENDDO.
      CHECK NOT lt_srvfil IS INITIAL.
      pt_srvfil = lt_srvfil.
    FORM p_to_date_time_tz  USING    p_ptime  TYPE p
                            CHANGING p_time   TYPE syuzeit
                                     p_date   TYPE sydatum.
      DATA:
        l_abaptstamp TYPE timestamp,
        l_time       TYPE int4,
        l_opcode     TYPE x VALUE 3,
        l_abstamp    TYPE abstamp.
      l_time = p_ptime.
      CALL 'RstrDateConv'
        ID 'OPCODE' FIELD l_opcode
        ID 'TIMESTAMP' FIELD l_time
        ID 'ABAPSTAMP' FIELD l_abstamp.
      l_abaptstamp = l_abstamp.
      CONVERT TIME STAMP l_abaptstamp TIME ZONE sy-zonlo INTO DATE p_date
          TIME p_time.
    ENDFORM.                    " p_to_date_time_tz
    Regards,
    Clemens

  • When i close firefox.how to save firefox.without losing any data,and when i restart.the tabs come back.how

    how to save firefox,without losing data.that means when i am closing firefox its not asking to svae or not

    In the Tools menu select Options to open the options dialog. Select the General panel and change the setting "When Firefox starts" to "Show my windows and tabs from last time".

  • How to Publish SAML 2.0 Meta Data using WLST

    Hi All,
    I would want to know who to publish SAML2.0 metadata using WLST commands? Is there a way to export xml as is done from Weblogic Console >MyServer > Configuration > Federation Services > SAML 2.0 General > Publish Meta Data?
    Regards, Nitish

    Wikipedia has a good article on SAML and how it works: Security Assertion Markup Language - Wikipedia, the free encyclopedia
    For it to work in BO, you would need an identity provider and a service provider, and the ability to pass in one of the parameters mentioned in the Admin Guide  (such as REMOTE_USER). The identity provider and service provider would be specified by your organization (we use Shibboleth for example). You may also need to install Apache if your SP does not talk directly to Tomcat (and in which case you can skip the web.xml configuration on p221), though there is other configuration needed for that scenario.
    I don't know the answer to your Windows AD question, but it appears there is an AD/SAML service available: Active Directory Federation Services

  • How to find Info Source for Export Data source in Data Marts node

    Hi
                  I need to load data from ODS to Info Cube. I created the Export Data source for the ODS. I can see the Export Data Source but in the Data Marts node of Info Source i cannot find the Info Source for the Export Data source i created. I replicated Data sources in the BW source system. I also tried to use Insert Lost Nodes from the Context Menu of the InfoSource node but nothing worked. Please let me know what i need to do to see the Info source in the Data Marts.
    Thanks
    Padma

    In the infosource tab in RSA1 - use settings --> display generated objects
    you will be able to see the datamart infosources..

  • How to SAVE a updated XML DOM Data to the file?

    Hi
    I am able to load an XML file into a XML DOM object using JAVA (xerces). I have update the required data in the DOM.
    But I am NOT able to save back the data to the physical file.
    Will appreciate if you can help me ASAP.

    Hi Krishar,
    Check out the jaxp new release on java.sun.com. This api has classes and methods to help you do the same.
    sample code:
         try
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              java.net.URL url = this.getClass().getResource(XML_FILE);
              java.io.File thsFile = new java.io.File(url.getFile());
              DocumentBuilder builder = factory.newDocumentBuilder();
              TransformerFactory tFactory = TransformerFactory.newInstance();
              Transformer transformer = tFactory.newTransformer();
              document = builder.parse(thsFile);
    //You can do any modification to the document here
              DOMSource source = new DOMSource(document);
              StreamResult result = new StreamResult(thsFile);
              transformer.transform(source, result);
         catch (TransformerConfigurationException tce)
              System.out.println("\n** Transformer Factory error");
              System.out.println(" " + tce.getMessage());
              Throwable x = tce;
              if (tce.getException() != null)
                   x = tce.getException();
              x.printStackTrace();
         catch (TransformerException te)
              System.out.println("\n** Transformation error in add:");
              System.out.println(" " + te.getMessage());
              Throwable x = te;
              if (te.getException() != null)
                   x = te.getException();
              x.printStackTrace();
         catch (SAXException sxe)
              System.out.println("sax exp" + sxe.getMessage());
         catch (Exception ex)
              System.out.println("exc exp" + ex);
              ex.printStackTrace();
    Hope this will help you XML_FILE is constant representing the path of the file. It should be in classpath. The program essentially parsing a xml file and creating dom document and then writing it back to the same file. you can do any modifications/write to other file etc...
    Think this will suffice your requirement
    bye
    take care
    Hi
    I am able to load an XML file into a XML DOM object
    using JAVA (xerces). I have update the required data
    in the DOM.
    But I am NOT able to save back the data to the
    physical file.
    Will appreciate if you can help me ASAP.

  • Regex question: How do I insert commas between meta data?

    Current search engine is being replaced with Google Search Appliance (GSA). It requires meta data to be separated by a comma + space, whereas the previous search engine required only a space.  For example:
    <meta name="C_NAME" content="Screen1 Screen2">
    must become
    <meta name="C_NAME" content="Screen1, Screen2">
    There are 17 unique screen names and each of 2500 html files may have one or more screen names identified in that meta tag field.
    I am hoping for some regular express magic to help me with that global search/replace effort.  Suggestions are greatly appreciated.
    Thanks,
    Rick
    ================================
    Nevermind... figured it out.  Just needed to study regex syntax a bit. Here's the answer:
    Find:  <meta name="C_NAME" content="(\w+)\s(\w+)\s
    Replace:  <meta name="C_NAME" content="$1, $2,

    The only transition you can add this way is default cross dissolve. If the images are in the timeline, move the playhead to the beginning of the images, select them all, and drag from the timeline to the canvas to overwrite with transition.

  • Is it possible to copy the iTunes meta data to the mp3 files themselves?

    I have recently began using MS Windows 8. As a long time user of iTunes, I have a very large and well organised library.
    The music app built into MS Windows 8 is something which I would like to start using. Yet, it builds the music database from the mp3 files themselves; which after using iTunes for so long contain little (zero) information to describe each file.
    Is it possible, to transfer the meta data stored in my iTunes library and save it to the mp3 files themselves - so that when I open the files in another media player, it contains the same descriptive information?
    In advance, thanks.

    Normally any meta data you edit in iTunes is copied to the tags, although iTunes doesn't always update things properly if the files in question have two or more embedded tags. You can however move the entire library without losing any information as follows.
    These are two possible approaches that will normally work to move an existing library to a new computer.
    Method 1
    Backup the library with this User Tip.
    Deauthorize the old computer if you no longer want to access protected content on it.
    Restore the backup to your new computer using the same tool used to back it up.
    Keep your backup up-to-date in future.
    Method 2
    Connect the two computers to the same network. Share your <User's Music> folder from the old computer and copy the entire iTunes library folder into the <User's Music> folder on the new one. Again, deauthorize the old computer if no longer required.
    Both methods should give the new computer a working clone of the library that was on the old one. As far as iTunes is concerned this is still the "home" library for your devices so you shouldn't have any issues with iTunes wanting to erase and reload.
    I'd recommend method 1 since it establishes an ongoing backup for your library.
    If you have an iOS device that syncs with contact & calendar data on your computer you should migrate this information too. If that isn't possible create a dummy entry of each type in your new profile and iTunes should offer to merge the existing data from the device into the computer, otherwise the danger is that it will wipe the information from the device.
    If your media folder has been split out from the main iTunes folder you may need to do some preparatory work to make it easier to move. See make a split library portable.
    Should you be in the unfortunate position where you are no longer able to access your original library, or a backup of it, then see Recover your iTunes library from your iPod or iOS device for advice on how to set up your devices with a new library with the maximum preservation of data. If you don't have any Apple devices then see HT2519 - Downloading past purchases from the App Store, iBookstore, and iTunes Store.
    tt2

  • Can I copy meta data from a jpg and past to a tiff. I have CS6 photoshop

    How can I copy metadata from a JPg files and paste onto tiffs.  I send JPGs to stock agent and when they select I then send Tiffs and want to avoid re typing meta data if possible.  Also some pictures have similar meta data information and can I copy that and paste into another picture?
    Please give me keystroke information if this is possible as I get confused easily.  Use photoshop for dummies language if you can.
    thanks a lot  Gail

    You can copy&paste individual fields, but not the entire data. It's a moot point, anyway. PS will retain metadata e.g. when a file is saved using Save As... to a format that supports metadata and JPG and TIFF both do. also one would simply use Bridge to edit metadata in mass with multiple images selected...#
    Mylenium

  • Missing Meta data in Gallery JSON file

    I have bought a GEOtagger device and I am using GPS2Aperture to get the meta data into my Aperture library. But when you export the pictures to a Web Gallery Album the meta data is not exported. I found out it is not MobileMe too blame. When you look at the JSON file that is created by the Aperture export function you will see that the meta data is missing! The JSON file is located at: iDisk (iDisk > Web > Sites > _gallery > yourgalleryname), you'll see a list of folders each containing the photos in that particular gallery. And within each folder, there's a file called exif.json, which is a type of JavaScript that holds the EXIF information.
    I looked on the Internet to see if other users have this problem but it seems I am the only one This automatically raises the question: Is it just me or is noby using GeoTags?
    Anybody else has this problem?
    Message was edited by: kwarts

    I am having the same problem whereby Aperture sometimes exports the EXIF information and sometimes it doesn't. The photos are geotagged, and Aperture shows this information. But, sometimes it appears with the info command in a Gallery and sometimes not.
    I've got to check more closely, but it did appear in a gallery for which I allowed downloading. But, it did not appear in a gallery for which I did not allow downloading. I'm not sure, yet, if this is what does it.

  • How to skip footer details when loading data from a .txt file

    Hello experts,
    i have to import data from a txt file into my database. I have skipped my header info by using SKIP but how can i ignore my footer details.
    Thanks

    Reply on your other thread:
    Processing txt file for a required format

  • How to update a table AUTOMATICALY with data from a .txt file??

    HI ,
    I want to upload data which is in a notepad file and Create a table. This notepad file stores a string of datas. Here, the data comes in to the .txt file every second.
    (The data is actually stored into the notepad file when a program is executed in Processing.js software)
    Is it possible to do the following using APEX ? ?
    1. This table has to be updated automatically once in 2 minutes (I want this completely automatic, no human intervention -- no update buttons)
    2. A report is to be created in a apex application with this table, it should reflect the updates in the table every 2 minutes.
    Is it possible?? give your ideas.. I want to do this soon for my engineering project :) Any help from you is appreciated. :)
    Edited by: user13301695 on 28-Mar-2011 10:09

    And how do you expect your database server to access a local file in your machine ?
    Is the file accessible from outside your machine say inside a webserver folder so that some DB process can poll on the file ?
    Or, is your DB server in the same machine where you have the text file ?
    You will have to figure out the file acess part before automating user interaction or even auto-refreshing.

  • How to save the value in Cedit control into a text file bu using measurement studio c++?

    Im using measurement studio c++ to create a application. How to save a randomly generated value which display in the CNumberEdit Control to a text file? how to do the coding part?

    You can use the CNiFile class to write the value out to a file. For example, create a new Measurement Studio C++ project and follow these steps:
    Add a CNiNumEdit to the dialog.
    Add a member variable for the CNiNumEdit called m_numEdit.
    Add a button to the dialog.
    Double-click the button to add a message handler for the button's BN_CLICKED message.
    Add the following code to the button's BN_CLICKED message handler:
    CNiFile file("C:\\Values.log", CFile::modeCreate | CFile::modeWrite | CFile::typeText);
    file << m_numEdit.Value << endl;
    file.Close();
    Run the application, edit the CNiNumEdit's value, and click the button. The value should be written to the Values.log
    file as specified in the code above.
    Hope this helps.
    - Elton

Maybe you are looking for