Saving BitmapData as jpeg file

I've been working on an AIR image editing application for a
few weeks now and i'm suddenly realizing that there seems to be no
easy way to save BitmapData as a JPEG file. I have found flash
examples that call php scripts in order to save jpegs, but is this
even possible when running only local code? How can I do this???
Will this functionality be available any time soon? Any suggests of
ways to do this would be GREATLY appreciated.
Thanks!

Well I have only used the JPGEncoder class, but the
PNGEncoder seems to work the same way... All I needed was something
to take my BitmapData object and give me a ByteArray that can be
written to meet the jpeg format specification. So basically, you'd
do something like this:
//assuming you already have some BitmapData called
myBitmapData
var stream:FileStream = new FileStream();
stream.open(newFile, FileMode.WRITE);
var bytes:ByteArray = new PNGEncoder().encode(myBitmapData);
stream.writeBytes(bytes);
stream.close();
If you need to do something a little different, you might
need to look through the functions in the PNGEncoder class a little
more.
Also, if you were implying you're actually confused as to how
to import the corelib, you should be able to either import it as a
new project or import the com.adobe.images package into your
current project and use the classes that way.
Hopefully this helps... I'm still sorta just getting the hang
of this stuff myself.

Similar Messages

  • Automatic inverted colors when saving PDF as JPEG file

    Every time I save a pdf as an image file the colors of the image are inverted. I've done this before using Acrobat, but since I've downloaded it onto my new laptop (maybe it's because it's a newer version) it automatically inverts the image colors. How can I avoid this?

    You should ask in Acrobat
    This forum is not about using individual programs
    This forum is about the Cloud as a delivery & install process
    If you start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • Photoshop Jpeg Files

    Hi. I've recently installed Photoshop CS4 Extended on my new Imac. I am a photographer and have saved a number of edited Jpeg images into my Pictures folder on my Mac in order to upload onto a Color Labs Site for printing. I have never had a problem uploading any images on my windows based laptop. All of my edited Jpeg Images are now saved as "Photoshop Jpeg Files" I am now unable to export any of these images as the files do not appear to be recognised when I attempt to open them. Additionally, I can't even import them into Lightroom 2 as it comes up as No photos to import. Please can somebody help.... 

    Yes it sounds like somethings wrong with the jpg pictures- sure you really saved them as jpg and not just naming them as such by fault?
    Secondly, I've experienced some windows based servers not be able to recognise jpg saved with a Mac-preview.
    So you could try saving your files with no preview.
    Torben.

  • Newbie question: saving jpeg files in indesign document

    hi there,
    i'm rather new to indesign and i can't get this thing to work:
    whenever i place a jpeg image (or for that matter, any other image format) into an indesign document and later move
    the jpeg file to a different location on my harddrive and then reopen the indesign file, the image is all pixeled. it seems like the image
    isn't saved inside the .indesign file, but is more of a referal to the file on my hard disk.
    is it possible to embed external files (like jpeg) into the actual indesign document and save them within this document?
    i'd be gracious for any help.

    Grant's answers are correct. You SHOULD use linked images and you should update them on the Links panel.
    There are specialized reasons it might be necessary to embed an image, but in general it's not a good idea: (1) It makes the files unnecessarily large, (2) if you make changes in the image, it can be updated in the InDesign file.

  • TS3276 Having trouble sending jpeg images as attachments in Mac email.....they go thru as images and PC users can't see the SAVE or QUICK LOOK boxes that Mac mail has.  One friend scrolled over the image, right clicked on it and saved as a PNG file.

    Having trouble sending jpeg images as attachments in Mac email.....they go thru as images and PC users can't see the SAVE or QUICK LOOK boxes that Mac mail has.  One friend scrolled over the image, right clicked on it and saved as a PNG file.

    Apple Mail isn't going to change the format of any of your attachments. it isn't going to corrupt them either.
    Exchange is a transport protocol and server. The issue you describe is not related to Exchange.
    There are many different versions of Microsoft Outlook in use and they all have e-mail bugs. Different versions have different bugs. Some Apple Mail hack to get around a bug in Outlook 2003 may cause the same message to be problematic in Outlook 2000. Fix them both and another issue will cause trouble in Outlook 2007. You can't fix this. Apple can't fix this. Microsoft can and has but that is irrelevant if your recipients are using older versions.
    One specific problem is that Apple Mail always sends image attachments inline, as images, not as iconized files. You can change this with Attachment Tamer. Just be aware that use of this software will break other things such as Stationery. E-mail is just a disaster. To date, no one outside of Apple has ever implemented the e-mail standards from 1993. Apple has continually changed its e-mail software to be more compatible with the de-facto standards that Netscape and Microsoft have unilaterally defined and people documented as "standards" after the fact. The e-mail messages that Apple Mail sends are 100% correct and do not violate any of the original standards from 1993 or the Microsoft/Netscape modifications. The problem is entirely bugs and limitations in various versions of Outlook.

  • Illustrator CS6 jpeg file saved looks distorted when uploaded onto internet

    I am helping  a pal of mine on illustrator and I have little knowledge so Im asking here. They made a simple type and shape design with a solid backdrop. When I tried to export via save for web to jpeg with high settings, it came up online with subtle but visible alterations. Behind my shapes are speckled like dust, it looks super low quality.
    I'm not sure what info would help solve this, but maybe someone else has made an oopsie and can tell me how to fix it. I tried using ps to save instead, I even tried removing the backdrop and remaking a whole new document and just moving select items over, then recoloring..which was not the best attempt but same result.
    I'm not exactly sure what her color settings should be to avoid this. Im working at 6500 x 6500 right now.
    Here's a visual of the up close issue.
    All over its less quality. And Im saving at top jpeg settings in RGB
    I really don't want to tell her she has to begin all over again, thanks in advance for help.
    Oh, on her pc there is no distortion. It's just online where it becomes crazy.

    Are you sure she can't take gif? It can be rgb, and for this style of art, it will look better than jpeg. This is a quick recreation of your file section, as a medium-low quality gif.

  • Preventing .jpeg files from being generated/saved

    I'm trying to capture a graph on the front panel into an .html file using the case structure in the attached .vi.  The case structure works but I keep getting  a jpeg file in the form of CT0327xxxxxxx.jpeg saved in the C:\vibration data directory each time a capture is performed.  How do I keep this image from either being generated or saved?  Thanks in advance.
    Message Edited by GSO on 09-12-2007 10:33 AM

    Sorry. Here it is.
    Message Edited by Dennis Knutson on 09-12-2007 11:18 AM
    Attachments:
    Append Image.PNG ‏46 KB

  • Edited RAW files not saved as .JPEG files

    Before I updated to iPhoto8, when I edited my RAW files they were saved to JPEG files automatically. From the Help documentation, I believe that this should still be happening..... but it isn't.
    Do I have a setting wrong? Anyone know?
    Thanks.

    Check the entry "About nondestructive editing" in iPhoto Help. With iPhoto '08 you will not see the "save" progress bar unless the photo was previously edited in iPhoto 6. Here is a portion of the text:
    Nondestructive editing allows you to try different adjustments and effects at will⎯there’s no danger that successive edits and saves will degrade your photo’s quality. You’re never more than one version away from your original photo. Instead of saving a new version over the previous one every time you edit a photo, iPhoto ’08 simply remembers all your changes as an edit list.
    When you reopen your edited photo to view or do more work, iPhoto then reapplies those edits to the original version. You’ll see where you left off, so you can make incremental changes from there.
    IMPORTANT: For photos imported to earlier versions of iPhoto and never edited, nondestructive editing will apply in iPhoto ’08.
    However, for photos imported to earlier versions and edited either in iPhoto or in a separate application such as Photoshop, nondestructive editing does not apply.

  • SAVING gif & jpeg files in differ graphic titles

    SAVING gif & jpeg files in differ graphic titles appear
    presave settings... what are ?
    gif
    ===
    Row Order: Normal or Interlaced
    jpeg
    ====
    Format Options: Baseline-Standard or Baseline-Optimized or
    Progressive

    else if(fileName.endsWith(".jpg") || fileName.endsWith(".jpeg") || fileName.endsWith(".gif")) {
        response.setContentType("text/html");
    }You're forcing images to use contenttype text/html instead of binary image.
    This is a weak control though. Rather use URLConnection#guessContentTypeFromName() to retrieve the contenttype.
    Also see the following articles for ImageServlet and FileServlet examples to get some new insights:
    http://balusc.xs4all.nl/srv/dev-jep-img.html
    http://balusc.xs4all.nl/srv/dev-jep-fil.html

  • Saving a JPEG file for printing

    When saving a JPEG file for printing using Elements9, should one use "baseline standard, optimized or progressive"?

    Thanks, Andromeda....  I see that PSE8 Organizer has the ability to update the Caption as you have described.  The caption appears in the Description field in the General area and in the Description field in the IPTC area of the image file.  I was unable to update the Title or any other fields using Organizer.  Looks like PSE8 Editor must be used to update all the metadata fields in the image file.  Thus far, the only way I have been able to update the metadata in a JPEG file without having to re-compress it is with a HEX editor.  This, however, is a slow process at best.  Too bad Organizer or Editor does not provide the abilty to update all fields in the metadata without having to recompress the file.  I am not a programmer; however, it would appear to be a fairly straight-forward process.  Thanks, again.

  • Cannot print to PDF file after saving it to JPEG

    I get the following error when I try to print to a .pdf file that I just saved to a .jpeg.
    "Adobe PDF" cannot access the file because it is in use by another applicaiton or process:
    C:\Users\<username>\Desktop\junk.pdf
    Verify that the file is not open by another application or process and try again.
    I am using Acrobat X Pro on x64 Win 7.
    Here are the steps I take to produce this error:
    1.  Print any file to the "Adobe PDF" printer
    2.  Save that .pdf file as a .jpeg
    3.  Close JUST that particular .pdf file while leaving Acrobat X up (clicking the small black x on the top right).
    4.  Try to print any other file to "Adobe PDF" with the same name as the .pdf file I just closed.
    I do not get the error if I do not save to .jpeg, or when I close Acrobat X completely, but the user who is complaining about this error keeps multiple .pdf files open and doesn't want to have to close Acrobat X out completely every time.
    Any ideas? 
    Thanks in advance!

    Thanks Pat.  Tried each, restarted computer each time; tried the "Accept" routine several days ago - it worked briefly and then stopped.  Uninstalled Reader and Flash as well.  Strange thing with Flash, one of my online broker programs provides streaming of CNBC.  When I clicked on the CNBC option to initiate CNBC, I got a message saying that I needed to load Flash.  I did, and it loaded again with no mention of Flash having already been installed.
    Using Internet Explorer works, as well as, clicking on the .pdf file within Windows Explorer (WE).  Expanding the window in WE makes it large enough to read.  I would still like to find a way to open the files as they are designed to open.
    I have done all of the Adobe updates as they have been presented.  Microsoft updates load automatically, and restart my computer in the process.  I do not look to see what the updates have been.  I figure if there was not a need, Microsoft would not make the updates.
    [private data removed]

  • Why am I being told that a JPEG file that I made changes to in Photoshop 6 (CS6) can't be saved?  The message I get says that either the file is locked and I don't have permission to execute this or another program is using this file.

    i recently purchased a 21.5 iMac with Yosemite (10.10.1) and was disappointed to discover that my CS6 programs are not functioning correctly.  I am unable to use the "Save As" command  when making changes to a JPEG file in Photoshop.  The message I get says that either another program is using the file or it is locked and I don't have permission to execute that command.  I'm experiencing a similar problem in Bridge when trying to move an unwanted file to the Trash.  Again, I get a message telling me that i don't have permission to do this.  Lastly, I'm unable to open any Camera Raw files.  Any suggestions?  I had no problems with the Mavericks OS on my old iMac and although it's much slower, I'm tempted to go back to using my old iMac.  At this point, I feel as if I've just wasted $2300+ (tax included). 

    Back up all data before proceeding.
    This procedure will unlock all your user files (not system files) and reset their ownership, permissions, and access controls to the default. If you've intentionally set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it, but you do need to follow the instructions below.
    Step 1
    If you have more than one user, and the one in question is not an administrator, then go to Step 2.
    Triple-click anywhere in the following line on this page to select it:
    sudo find ~ $TMPDIR.. -exec chflags -h nouchg,nouappnd,noschg,nosappnd {} + -exec chown -h $UID {} + -exec chmod +rw {} + -exec chmod -h -N {} + -type d -exec chmod -h +x {} + 2>&-
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    Paste into the Terminal window by pressing command-V. I've tested these instructions only with the Safari web browser. If you use another browser, you may have to press the return key after pasting.
    You'll be prompted for your login password, which won't be displayed when you type it. Type carefully and then press return. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command may take several minutes to run, depending on how many files you have. Wait for a new line ending in a dollar sign ($) to appear, then quit Terminal.
    Step 2 (optional)
    Take this step only if you have trouble with Step 1, if you prefer not to take it, or if it doesn't solve the problem.
    Start up in Recovery mode. When the OS X Utilities screen appears, select
              Utilities ▹ Terminal
    from the menu bar. A Terminal window will open. In that window, type this:
    resetp
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not going to reset a password.
    Select your startup volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
               ▹ Restart
    from the menu bar.

  • Lightroom 5 - JPEG files saved to folder but did not import into catalog

    I am using Lightroom 5. My camera is set to save each image as RAW & JPEG. At import, I chose to "Copy as DNG". In the Lightroom catalog only the DNG files are imported. However, in the folder there are DNG files and JPEG files. Why didn't my JPEG images import to the catalog?

    Because you probably haven't selected the option on the General Tab of the Preferences to "Treat JPEG files next to raw files as separate photos".

  • Cannot open JPEG files in Camera Raw from Bridge

    I am using Adobe Web Premium CS3 with Windows Vista. In Bridge under File, the "Open in Camera Raw" is grayed out. In preferences, I checked "Double-Click Edits Camera Raw Settings in Bridge" and when I double-click a JPEG file it still opens in Photoshop CS3. I've downloaded and installed the latest Camera Raw plugin (Camera Raw.8bi dated 3/27/2008) into Program Files/Common Files/Adobe/Plug-Ins/CS3/File Formats. Nothing seems to work.

    I am experiencing the same problem under XP SP2. It is intermittent. Everything will be OK and then the next time I open the folder Camera Raw is not available.
    I just did a little experiment. I created a sub-folder in the folder that would not produce Cam Raw and moved a jpg to it. When I right clicked it in the new folder, Cam Raw was there as it should be. I moved the jpg back to the original folder that had the problem and Cam Raw opened in that folder too, but not on any of the other jpg's in that folder.
    I moved all of the jpg's to this sub folder and back and Cam Raw was there on all the jpg's.
    There is without a doubt some real flakies in Bridge. I also have workspaces saved that suddenly are not saved any more.
    Hope this helps out your problem Donald. Oh, I am using web premium CS3 also

  • How to use the frameaccess code to convert video frames to jpeg files

    Hello everyone. I am working on a project on video processing, and i need to be able to do image processing on individual video frames. However, to do this, I need to convert the frames to an appropriate format, namely jpeg. It is actually the conversion from buffer frame to BufferedImage that is important, as i already have an approximate knowledge of filewriter for the saving of already rendered file.
    The original frameaccess code can be found here: http://java.sun.com/products/java-media/jmf/2.1.1/solutions/FrameAccess.html
    there are several other threads tied to this topic, some of which do not work for me, or simply do not suit my needs, so please do not link me to them unless you are sure its the real solution.
    if any one could help me by showing me the way of doing it correctly, and maybe give a nice short explanation, i would be very grateful.
    Thanks you.
    P.s: i am only a beginner to intermediate student in java and programming in general so...

    Here is the code i am currently using.
    package Test;
    import java.io.*;
    import java.util.*;
    import java.awt.*;
    import javax.media.*;
    import javax.media.control.TrackControl;
    import javax.media.Format;
    import javax.media.format.*;
    import javax.media.bean.playerbean.MediaPlayer;
    import javax.media.util.*;
    import java.awt.image.BufferedImage;
    import java.awt.image.RenderedImage;
    import java.awt.image.*;
    import javax.imageio.ImageWriter;
    import javax.imageio.ImageIO;
    import javax.media.control.FrameGrabbingControl;
    * Sample program to access individual video frames by using a
    * "pass-thru" codec. The codec is inserted into the data flow
    * path. As data pass through this codec, a callback is invoked
    * for each frame of video data.
    public class FrameAccess extends Frame implements ControllerListener {
    Processor p;
    Object waitSync = new Object();
    boolean stateTransitionOK = true;
    * Given a media locator, create a processor and use that processor
    * as a player to playback the media.
    * During the processor's Configured state, two "pass-thru" codecs,
    * PreAccessCodec and PostAccessCodec, are set on the video track.
    * These codecs are used to get access to individual video frames
    * of the media.
    * Much of the code is just standard code to present media in JMF.
    public boolean open(MediaLocator ml) {
         try {
         p = Manager.createProcessor(ml);
         } catch (Exception e) {
         System.err.println("Failed to create a processor from the given url: " + e);
         return false;
         p.addControllerListener(this);
         // Put the Processor into configured state.
         p.configure();
         if (!waitForState(p.Configured)) {
         System.err.println("Failed to configure the processor.");
         return false;
         // So I can use it as a player.
         p.setContentDescriptor(null);
         // Obtain the track controls.
         TrackControl tc[] = p.getTrackControls();
         if (tc == null) {
         System.err.println("Failed to obtain track controls from the processor.");
         return false;
         // Search for the track control for the video track.
         TrackControl videoTrack = null;
         for (int i = 0; i < tc.length; i++) {
         if (tc.getFormat() instanceof VideoFormat) {
              videoTrack = tc[i];
              break;
         if (videoTrack == null) {
         System.err.println("The input media does not contain a video track.");
         return false;
         System.err.println("Video format: " + videoTrack.getFormat());
         // Instantiate and set the frame access codec to the data flow path.
         try {
         Codec codec[] = { new PreAccessCodec(),
                        new PostAccessCodec()};
         videoTrack.setCodecChain(codec);
         } catch (UnsupportedPlugInException e) {
         System.err.println("The process does not support effects.");
         // Realize the processor.
         p.prefetch();
         if (!waitForState(p.Prefetched)) {
         System.err.println("Failed to realize the processor.");
         return false;
         // Display the visual & control component if there's one.
         setLayout(new BorderLayout());
         Component cc;
         Component vc;
         if ((vc = p.getVisualComponent()) != null) {
         add("Center", vc);
         if ((cc = p.getControlPanelComponent()) != null) {
         add("South", cc);
         // Start the processor.
         p.start();
         setVisible(true);
         return true;
    public void addNotify() {
         super.addNotify();
         pack();
    * Block until the processor has transitioned to the given state.
    * Return false if the transition failed.
    boolean waitForState(int state) {
         synchronized (waitSync) {
         try {
              while (p.getState() != state && stateTransitionOK)
              waitSync.wait();
         } catch (Exception e) {}
         return stateTransitionOK;
    * Controller Listener.
    public void controllerUpdate(ControllerEvent evt) {
         if (evt instanceof ConfigureCompleteEvent ||
         evt instanceof RealizeCompleteEvent ||
         evt instanceof PrefetchCompleteEvent) {
         synchronized (waitSync) {
              stateTransitionOK = true;
              waitSync.notifyAll();
         } else if (evt instanceof ResourceUnavailableEvent) {
         synchronized (waitSync) {
              stateTransitionOK = false;
              waitSync.notifyAll();
         } else if (evt instanceof EndOfMediaEvent) {
         p.close();
         System.exit(0);
    * Main program
    public static void main(String [] args) throws IOException {
         /*if (args.length == 0) {
         prUsage();
         System.exit(0);
         //String url = args[0];
         String url = new String ("file:D:FiMs/avpr.avi");
         if (url.indexOf(":") < 0) {
         prUsage();
         System.exit(0);
         MediaLocator ml;
         //MediaPlayer mp1 = new javax.media.bean.playerbean.MediaPlayer();
         //mp1.setMediaLocation(new java.lang.String("file:D:/FiMs/299_01_hi.mpg"));
         //mp1.start();
         if ((ml = new MediaLocator(url)) == null) {
         System.err.println("Cannot build media locator from: " + url);
         System.exit(0);
         FrameAccess fa = new FrameAccess();
         if (!fa.open(ml))
         System.exit(0);
    static void prUsage() {
         System.err.println("Usage: java FrameAccess <url>");
    * Inner class.
    * A pass-through codec to access to individual frames.
    public class PreAccessCodec implements Codec {
    * Callback to access individual video frames.
         void accessFrame(Buffer frame) {
         // For demo, we'll just print out the frame #, time &
         // data length.
         long t = (long)(frame.getTimeStamp()/10000000f);
         System.err.println("Pre: frame #: " + frame.getSequenceNumber() +
                   ", time: " + ((float)t)/100f +
                   ", len: " + frame.getLength());
         * The code for a pass through codec.
         // We'll advertize as supporting all video formats.
         protected Format supportedIns[] = new Format [] {
         new VideoFormat(null)
         // We'll advertize as supporting all video formats.
         protected Format supportedOuts[] = new Format [] {
         new VideoFormat(null)
         Format input = null, output = null;
         public String getName() {
         return "Pre-Access Codec";
         // No op.
    public void open() {
         // No op.
         public void close() {
         // No op.
         public void reset() {
         public Format [] getSupportedInputFormats() {
         return supportedIns;
         public Format [] getSupportedOutputFormats(Format in) {
         if (in == null)
              return supportedOuts;
         else {
              // If an input format is given, we use that input format
              // as the output since we are not modifying the bit stream
              // at all.
              Format outs[] = new Format[1];
              outs[0] = in;
              return outs;
         public Format setInputFormat(Format format) {
         input = format;
         return input;
         public Format setOutputFormat(Format format) {
         output = format;
         return output;
         public int process(Buffer in, Buffer out) {
         // This is the "Callback" to access individual frames.
         accessFrame(in);
         // Swap the data between the input & output.
         Object data = in.getData();
         in.setData(out.getData());
         out.setData(data);
         // Copy the input attributes to the output
         out.setFormat(in.getFormat());
         out.setLength(in.getLength());
         out.setOffset(in.getOffset());
         return BUFFER_PROCESSED_OK;
         public Object[] getControls() {
         return new Object[0];
         public Object getControl(String type) {
         return null;
    public class PostAccessCodec extends PreAccessCodec {
         // We'll advertize as supporting all video formats.
         public PostAccessCodec() {
         supportedIns = new Format [] {
              new RGBFormat()
    * Callback to access individual video frames.
         void accessFrame(Buffer frame) {
         // For demo, we'll just print out the frame #, time &
         // data length.
         long t = (long)(frame.getTimeStamp()/10000000f);
         System.err.println("Post: frame #: " + frame.getSequenceNumber() +
                   ", time: " + ((float)t)/100f +
                   ", len: " + frame.getLength());
         public String getName() {
         return "Post-Access Codec";
    and here is what itprabhu5 proposed to use to convert and save the frames as .png(or .jpeg in the same way)
    import java.io.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.image.*;
    import javax.imageio.*;
    import javax.media.*;
    import javax.media.control.*;
    import javax.media.format.*;
    import javax.media.util.*;
    * Grabs a frame from a Webcam, overlays the current date and time, and saves the frame as a PNG to c:\webcam.png
    * @author David
    * @version 1.0, 16/01/2004
    public class FrameGrab
         public static void main(String[] args) throws Exception
              // Create capture device
              CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0");
              Player player = Manager.createRealizedPlayer(deviceInfo.getLocator());
              player.start();
              // Wait a few seconds for camera to initialise (otherwise img==null)
              Thread.sleep(2500);
              // Grab a frame from the capture device
              FrameGrabbingControl frameGrabber = (FrameGrabbingControl)player.getControl("javax.media.control.FrameGrabbingControl");
              Buffer buf = frameGrabber.grabFrame();
              // Convert frame to an buffered image so it can be processed and saved
              Image img = (new BufferToImage((VideoFormat)buf.getFormat()).createImage(buf));
              BufferedImage buffImg = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
              Graphics2D g = buffImg.createGraphics();          
              g.drawImage(img, null, null);
              // Overlay curent time on image
              g.setColor(Color.RED);
              g.setFont(new Font("Verdana", Font.BOLD, 16));
              g.drawString((new Date()).toString(), 10, 25);
              // Save image to disk as PNG
              ImageIO.write(buffImg, "png", new File("c:\\webcam.png"));
              // Stop using webcam
              player.close();
              player.deallocate();
              System.exit(0);                    
    however, i am unable to use it together with my code... i m not even sure if im using it at the right place.. (note that u will have to discard some lines from the second code, because it is actually grabbing frames from a webcam in that example)
    if any1 can make it happen please help me. thx.

Maybe you are looking for

  • Printing with Lion and Adobe Reader 9.4.5

    Today, after installing Lion Wed, I needed to print a pdf document with mixed landscape and portrait pages. With AR 9.4.5 all the landscape pages were rendered in portrait, occupying about half of each sheet. With Preview, all pages printed as they s

  • 64bit Vista and iTunes/iPhone

    My new PC has Vista 64bit on it. I installed the 64bit iTunes and it seemed to install correctly but it doesn't recognize the iPhone. My iPod connects fine but the iPhone doesn't. I was on the phone with Apple tech support about an hour and finally t

  • Is there a cord to connect my iphone to my ipad?

    Is there a cord to connect my iphone to my ipad?  My ibook G4 is too old to download new itunes and I want to transfer all the stuff on my iphone to my ipad.

  • How do I write a VI for an AG-UC2 controller?

     I  need to be able to move a AG-LS25 piezo motor in both directions via labview.  If anyone has any examples of this and would be willing to give me some advice I would really appreciate it.  I have very little experience with labview and would appr

  • Can't get past the activation screen for iphone 3Gs

    I am trying to activate the iphone 3Gs after switching from blackberry. When I turn the phone on, I get to the "welcome"screen, I choose my country and then given the option to activate through WiFi or iTunes. When I activate through WiFi, I get a me