Storing images to persistent storage

Hi all
Does anyone know a good tutorial for storing images to persistent storage?
I am comfortable in the process of storing items such as int and string etc.
writeUTF ()
readUTF()
etc...But i cannot see how to store an image? and the inverse how to load the image back up.
Mainly my lack of knowledge hinges on the fact that I do not know how to convert an Image to a byte array and make an image from a byte array?
Then using this byte array what methods I uses from the DataOutputStream and DataInputStream for population?
If anyone knows or can help would be very grateful?
jimbobegg

For anyone concerned heres a solution I used in its own class:
public static void convertImageAndStore( Image photo, DataOutputStream daos )
     int imageWidth, imageHeight;
     imageWidth = photo.getWidth();
     imageHeight = photo.getHeight();
     int[] imgRgbData = new int[ imageWidth * imageHeight ];
     try
          photo.getRGB(imgRgbData, 0, imageWidth, 0, 0, imageWidth, imageHeight );
          //Start to write the different parts to the
          //DataOutputStream
          daos.writeInt( imageWidth );
                daos.writeInt( imageHeight );
                daos.writeInt( imgRgbData.length );
                //Serialize image and store
                //Serialize the image raw data
                for (int i=0; i<imgRgbData.length; i++)
                    daos.writeInt(imgRgbData);
     catch( Exception exc )
          System.err.println( "Exception thrown by Utility::convertImageAndStore()");

Similar Messages

  • Help needed in RMS Persistent Storage

    I used RMS record store to insert and retrieve records from and to a byte array ( I followed a tutorial example program), using ByteArrayInputStream , ByteArrayOutputStream classes.
    I want to store it permanently in a persistent storage.
    So, what should I do .?
    Please help me in this regard.
    Thank you.

    Thank for your response.
    But, I'm not clear.
    I was able to store records in a byte array stream and retireve it.
    So, I had to store and retireve the records from the same MIdlet.
    What if i closed the Midlet application and I want to retrieve the data at a later stage.( Like in desktops, data are stored in files in the filesystem, I want to know the filesystem in which my data wil be permanently stored.
    I'm using NetBeans 6.0 IDE
    I created a MIDlet.
    Please help.

  • Which is better datatype for storing Images in 11gr2 Database ?

    Can anyone tell me which datatype should be maintained for storing images in database in terms of
    1. Space
    2. Speed.
    And, Is there another way for storing images instead of database ?
    Thanks/Regards in advacne.

    982164 wrote:
    Which one have better speed, database system or file system ?Database is better all around. It is not just a question of speed. It is a question of storage, security, flexibility, scalability, robustness and so on.
    If you use ASM and raw devices from a storage array or SAN, how do you get o/s files onto that? (requires a file system on the SAN/array LUNs)
    If it is inside the database, database security, concurrency and consistency apply to the image. Outside the database? How do you control who has access? Prevent someone with slippery fingers from accidentally deleting/renaming/moving images files? How do you backup up the image data with the image attribute data in the database?
    Having all this inside the database, part of the database, managed by the database, provides you with more flexibility, robustness, and security. After all a RDBMS is a data management system - it is designed for managing data. And that includes managing binary data.
    As for speed. Reading a 24MB image is reading 24MB worth of data. Whether that data is read by process A from disk1, or process B from disk2 - the amount of data is the same. So if you want faster I/O, then use faster disks. If disk1 is faster, process A will perform better reading the image than process B. If disk2 is faster, the roles are reversed.
    So I/O speed is not a direct function of process A or process B. It is a direct function of the I/O storage and fabric layer. Yes, a process's method of I/O can make a difference (e.g. using block reads not aligned with the physical blocks on disk). But this is more a configuration issue than process doing badly designed I/O calls.
    So the speed question is a bit loaded as it has more to do with the architecture and design of the I/O system - and less to do with the process doing that I/O. You can have a highly optimised I/O process doing poorly using an old and slow I/O layer, and poorly written I/O process doing pretty well on a SSD I/O layer.
    Databases like Oracle is designed for dealing with data - and thus effectively dealing with I/O. Lots of it. For lots of data. So I/O process design is not a consideration. The database processes will use the I/O layer as optimally as possible and as configured.

  • Displaying server stored images in an air application

    Usually when I go about displaying server stored images in a regular flex application I go about it the following way:-
    - Create a mysql database table on a server which contains image names
    - Create a php file which generates all of the image namesfrom the table as xml and upload this file to the server
    - Create a new flex application/project
    - In the application make a http service which points to my php/xml file and turns this data into an array collection
    - Set the array collection to the dataprovider of a tilelist component so that all of the images will eventually be displayed within it when they are created
    - I set the itemrenderer of the tilelist to an image component which has it's source set to something like source="{'assets/images'+ data.imagename}" with imagename being the field containing the name of the image which is stored in the mysql database table.
    - Make a folder in the app/project called assets/images which will contain all of the images
    - Upload the app to the server and once it runs all the images will be displayed in the application
    - Then any images that are uploaded to the server can also be displayed as long as their names are added to the mysql database
    My question is though how do you get server stored images to display within an Air Application? My air app will be used on multiple machines but I want the images in it to be dynamic i.e. stored on a server and can be changed. How can this be done?

    I'm struggling to figure out how to access the image files when the assets/images folder will be on a server and the app itself will be on the user's desktop whereas usually in the case of a regular flex app this wouldn't mater as both the app and the image files would be on the server together. Is what I'm trying to do possible i.e. displaying images on a desktop air app straight from a server?

  • How to read the stored images

    hi
    i have images in my table img,
    i want to know how toretreive that stored image

    i have images in my table img
    > i want to know how toretreive that stored image
    How to retrieve it depends on how it is stored? What is the data type? Is it perhaps a blob (large object in binary format)? If so check out the package dbms_lob and read Application Developer's Guide - Large Objects. If not connect to your database using sql plus to publish the data type for the image column from the command "describe img".

  • Blob Problem (storing Images)

    AOA!
    I am working as a developer in a companey. we made a database for HRMS. In this database there is a table EMPLOYEE with a column PICTURE of type BLOB. We were using oracle 8i initially but when we migrate to oracle 9i, we are facing a problem in image storing. The situation is, database showing ur previously stored images (those have stored in oracle 8i) but when we save a new image in that table or any other table it seams to be saved but cannot retrived. I mean when we issue a query
    SELECT EMP_ID FROM EMPLOYEE WHERE PICTURE IS NOT NULL;
    It shows the new inserted records too (thats shows us that picture has been inserted) but when we issue query from a forms6i application it didnt show any image. In case of report, when we try to query a record which newly inserted with image, it says some thing like REPORT IS UNABLE TO SHOW IMAGE FORMATE etc.
    The situation is for all table and all schema which is indicating us may be it is some thing due to oracle 9i headen technique or due to miss managment by us. we dont have DBA in our companey.
    Please help us in this regard. We will be thankfull to you.
    Usman Rana
    Dont reply to above mantioned email my actual email account is [email protected]

    I think that both your SQL is wrong and your intended use is wrong. According to the SQL reference, the following seems to be a simplified definition that seems to match what you're trying to do. UPDATE &lt;table&gt; SET &lt;column&gt; = &lt;expr&gt;. So PROPERTIES should be a &lt;table&gt; of some kind and X should be a &lt;column&gt; of that table. This changes your PreparedStatement to *"UPDATE PROPERTIES SET X = ? WHERE NAME = ?"* Then you can do ps.setBlob(1, b) and ps.setString(2, ...). Because your statement is DML you must do ps.executeUpdate(). So your code might look something like this.
    Blob b = ...;
    String x = ...;
    ps = c.prepareStatement("UPDATE PROPERTIES SET X = ? WHERE NAME = ?");
    ps.setBlob(1, b);
    ps.setString(2, x);
    int i = ps.executeUpdate();
    The executeUpdate() returns the row count (i.e. number of rows) of your DML statement. Try that and see if it helps.

  • Storing data in structured storage

    I see everywhere that storing data in stuctured storage way is the better thing to do if we want to make fast search.
    But how can I do it.
    I only see that the default storage is clob for xmltype and we also can say "stored as clob" but how do it for store it in structured storage.
    Thank you.

    You need to register an XML Schema that defines your data. You then define the type of data your XML columns will contain using XMLSCHEMA and ELEMENT clauses..
    See the XML DB demo for more info

  • Storing Images In Oracle 9.2 Using Forms 6i

    When my database was 8.1.7, storing Images in the database in BLOB field worked fine through Form 6i. But when the database was upgraded to 9.2 then the images are not loaded in the database through Forms 6i.
    Kindly help
    Thanks

    Hi,
    I wanted to do the same thing and faced the same problem. I'm working on Forms 6i and Oracle 9i as backend.
    When an Image item is created on forms, it's datatype is set to Long Raw. You can see this by changing the type of the image item to text item. You'll see that the datatype is Long Raw. The idea of inserting the image would work perfectly if you set the datatype of the column to Long Raw in the backend.
    For using BLOB... I searched alot but all in vain. No answer as to how to handle BLOB in Forms 6i.
    Do let me know if you get a way out.

  • Folder for stored images (Portalheader)

    Hello experts,
    could anyone let me know where I can find all the uploaded images for the Portalheader(Masthead). Where can I find the folder who is ressponsible for the administration of the images/background images??
    Thank you
    Regards
    Marco

    Hi Marco,
    You can find those uploaded image files in KM. KM is like your file server but is within the Portal that you can use to manage your files/content/data. Files, content or data exist in KM can be index and search via the Portal TREX (Search Engine).
    SAP NetWeaver Training Overview - SAP Knowledge Management (KM)
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/06fac090-0201-0010-af9c-b67d14558014
    1) Storing images in Portal
    Storing images in Portal
    2) Simple static web pages and images? Store/refernence in KM?
    /thread/378997 [original link is broken]
    3) Upload Image to KM Repository
    /thread/26834 [original link is broken]
    4) showing image located in km folder
    showing image located in km folder
    Hope that helps.
    Ray

  • Does Azure Media services support storing images?

    Hi,
    We are planning to store the media files in azure cloud, initially we planned to use the Azure blob storage and after deeply investigating we found the Azure media services has some outstanding capabilities  like streaming offline viewing etc. compared
    to azure blob storage.
    So here my question, does this supports storing the images as well?Please confirm this ASAP.
    I read the some article about media services, there it has been given like below, but Just i want to confirmation about this.
    Supported file types in Azure Media Services
    Various video, audio, and image file types can be uploaded to a Media Services account, with there being no restriction on the types or formats of files that you can upload using the Media Services SDK. However, the Azure Management portal restricts uploads
    to the formats that are supported by the Azure Media Encoder. These import formats include MPEG-1, MPEG-2, MPEG-4, and Windows Media Video encoded video, MP3, WAVE, and Windows Media Audio encoded audio, and BMP, JPEG, and PNG encoded images. The Azure Media
    Encoder can export data as Windows Media Video, Windows Media Audio, MP4, and Smooth Streaming File Format.
    For more information about the supported file formats see "Supported input formats" and "Introduction to encoding."
    Thanks,
    Kiran

    Hi John,
    One more Question here.
    As of now we are planning to store and retrieve only the images and audio files with media services, so can I avoid encoding and packaging and use it?Will it work?
    Can I access the  images and audio files without encoding and packaging?
    In future, we are are planning to add the videos as well.
    I think encoding and packaging will come into picture when streaming the videos.
    Thanks,
    Kiran

  • Help Storing Images in rms

    Hola, Did someone get to stored sussecfully images in teh rms? I capture an image using MMAPI : snapshot() and i get a byte[] tyhat is waht I store in teh rms, but when open teh application again I get a error, I guess for the size of the picl, but I cvant choose the resoultion.l Actually teh pics are like 40 K and my applicatio is suppose to handle the capture and storage of 2 pics. OS i create a recolrd store recordPic= new byte[80000].
    Any ideas?

    You could also check whether this 10K for each picture is still working okay, by checking whether it is possible to save and reload a thumbnail of that picture.
    You've already read the article at http://developers.sun.com/techtopics/mobility/midp/articles/picture/.
    But it has a private method that can be used for testing a thumbnail and use that for saving in the rms. When you can read that image back again, then there's nothing wroing with how're you constructing the image. Then it's related to the image size.
    See this method (copied from the article) and use it for creating a thumbnail:
      private Image createThumbnail(Image image) {
      int sourceWidth = image.getWidth();
      int sourceHeight = image.getHeight();
      int thumbWidth = 64;
      int thumbHeight = -1;
      if (thumbHeight == -1)
        thumbHeight = thumbWidth * sourceHeight / sourceWidth;
      Image thumb = Image.createImage(thumbWidth, thumbHeight);
      Graphics g = thumb.getGraphics();
      for (int y = 0; y < thumbHeight; y++) {
        for (int x = 0; x < thumbWidth; x++) {
          g.setClip(x, y, 1, 1);
          int dx = x * sourceWidth / thumbWidth;
          int dy = y * sourceHeight / thumbHeight;
          g.drawImage(image, x - dx, y - dy,
              Graphics.LEFT | Graphics.TOP);
      Image immutableThumb = Image.createImage(thumb);
      return immutableThumb;
    }

  • User profile images not persisting after log off on Server 2012 R2 RDS Session Hosts

    Hi,
    We have a 2012 R2 remote desktop deployment, with two session collections, a gateway server, and connection broker.
    We have set these session collections to use centralised user profile disks.
    What I am having an issue with, is that when a user sets their profile image through the server they have logged on to (I have the desktop experience pack installed so they are able to do this), they can see the user tile has been set with that image in
    settings and also on the start menu, but as soon as they log off the server and back on, their profile image has been reset to the default blank image.
    I have checked all of my group policy options, and cannot find any settings that could be impacting this.
    Does anyone have any ideas why these images are not persisting for users or admins?
    Thanks, Eds

    Please check that the user is not getting a temporary profile each time he logs in. Also, make sure that the RDP client is properly configured to display the Wallpaper: http://www.webapper.com/blog/index.php/2007/10/18/enabling-desktop-wallpaper-on-remote-desktop-terminal-services/
    This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.
    Get Active Directory User Last Logon
    Create an Active Directory test domain similar to the production one
    Management of test accounts in an Active Directory production domain - Part I
    Management of test accounts in an Active Directory production domain - Part II
    Management of test accounts in an Active Directory production domain - Part III
    Reset Active Directory user password

  • Storing images on external hard drive but using iPhoto

    Hi
    I am a new apple user so I'm trying to figure out how to use iPhoto. I think it's a great way to organize my photos but I've run into the problem of my hard drive getting to small for my images so I wan't to put all of my images on an external hard drive to free space on my MacBook. Can I do that and still use iPhoto to tag people and organize my pictures? Will I always have to have the hard drive connected to be able to use iPhoto or does it "cache" the images so that I can organize them but not view the full pictures?
    (My iPhoto is called iPhoto '09 version 8.1.2)
    Would very much appreciate a little guidance! ;-)
    Angelica

    Yes you can do this.
    Make sure the drive is formatted Mac OS Extended (Journaled)
    1. Quit iPhoto
    2. Copy the iPhoto Library from your Pictures Folder to the External Disk.
    3. Hold down the option (or alt) key while launching iPhoto. From the resulting menu select 'Choose Library' and navigate to the new location. From that point on this will be the default location of your library.
    4. Test the library and when you're sure all is well, trash the one on your internal HD to free up space.
    This means that you will always have to have the disk connected to view the pics.
    You can also do it differently, where the Library is stored on the Mac and the Photos are on the external.
    But...
    I very strongly recommend that you do not do this. See this thread here for more on that
    https://discussions.apple.com/thread/3062728?tstart=0
    Regards
    TD

  • Storing images of different format in the same table

    Hi there,
    I have a table with one field of type OrdImage and I am saving in such a table images that are actually stored in an external directory. If images are of the same type everything works fine but if I mix jpeg and gif images I got an error while populating the image properties:
    ORA-29400: data cartridge error
    IMG-00704: unable to read image data
    ORA-06512: at "ORDSYS.ORDIMG_PKG", line 420
    ORA-06512: at "ORDSYS.ORDIMAGE", line 25
    Thanks for Your help
    Leonardo
    null

    I need clarify a thing:
    If you store image1.jpg only and do setProperties(), it works, and
    if you store image2.gif only and do setProperties(), it works, but
    if you store image1.jpg in one row and image2.gif in another row and do setProperties(), does it fail?
    If this is true, call Oracle Support and provide the image files.
    null

  • Storing images and icons in a JAR file

    Hi,
    I current have a JAR file to store our application icons in the GIF format. The application also uses several images which I would prefer to be stored in the JAR file as JPG files.
    Is it possible to store both GIFs and JPGs in a JAR and access them from Forms?
    For Example:
    I am using code like:
    read_image_file('mess_bold.jpg','URL','IM_BOLD');
    and I have this image file in the JAR but I get the error...
    Unable to load image mess_bold.jpg for Image Item
    Also the Apache log shows...
    File does not exist: c:/oracle/frhome_1/forms/java/icons/mess_bold.jpg.gif
    Is this a config problem? I noticed that the read_image_file call looks in the icons directory which I specify in my Registry.dat file. Do the settings for default.icons.iconpath and default.icons.iconextension apply to images as well?
    Thank you in anticipation.
    Regards,
    Tom Casserly

    Hi,
    I already had the entry imageBase=codebase in my formsweb.cfg
    According to this article it is possible to read images from the JAR using the 'URL' parameter see
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:2109110130595761322::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,137397.1,1,1,1,helvetica
    I have managed to get the images loading from the JAR but only if I have them in the same directory and format (ie gif) as the icons. As I suggested above I think that read_image_file must be accessing the default.icons.iconpath=icons/ default.icons.iconextension=gif from my Registry.dat file.
    There is also a slight problem that you cannot seem to use read_image_file in the WNFI or PF trigger as suggested here: Re: Read images from a jar file?
    Has anyone managed to access images from a JAR in JPEG format alongside GIF icons?
    Thanks for you help.
    Regards,
    Tom Casserly

Maybe you are looking for