Help..frame o/p to png format

please tell me how to convert the frame output to *.png (image file format) and to store in a
particular location

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;
public class X {
    public static void main(String[] args) throws IOException {
        JButton btn = new JButton("save");
        btn.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent evt) {
                Window win = SwingUtilities.getWindowAncestor((Component) evt.getSource());
                if (win != null) {
                    int w = win.getWidth(), h = win.getHeight();
                    BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
                    Graphics2D g = image.createGraphics();
                    win.paint(g);
                    g.dispose();
                    try {
                        ImageIO.write(image, "png", new File("temp.png"));
                    } catch (IOException e) {
                        e.printStackTrace();
        JFrame.setDefaultLookAndFeelDecorated(true);
        JFrame f = new JFrame("X");
        Container cp = f.getContentPane();
        JTextArea area = new JTextArea();
        area.read(new FileReader("X.java"), null);
        cp.add(new JScrollPane(area));
        cp.add(btn, BorderLayout.SOUTH);
        f.setSize(400,300);
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
}

Similar Messages

  • I just set up a new computer running Windows 8.1. When I go to my icloud photostream, the pictures are in PNG format NOT JPG. When I open and upload photos from the photostream, the resolution is so low that the image quality is terrible. Help?!?

    I just set up a new computer running Windows 8.1. When I go to my icloud photostream, the pictures are in PNG format NOT JPG. When I open and upload photos from the photostream, the resolution is so low that the image quality is terrible. Help?!?

    Hey Sierra, You can do just what you have stated. My question, what is your "other"? If it is over 1.5 GB you most likely have corrupt files. Doing a Restore to New, Factory restore should correct it. Just make sure you make a full backup of all information on your iPod to your computer before you restore, so you don't lose your stuff, contacts, videos, pictures, non-iTunes music, etc, use the cable and connect with your computer. Then, via cable, connect to your computer, run the Restore to new, don't use your backup. Treat this iPod as if it was your first one ever. When restore is done, set up and add what info you wish to install on this iPod. The music apps etc you purchased should be on your computer, if not you should be able to retrieve purchased apps and music from iTunes. Any music, videos, apps not purchased from iTunes will be lost to you if you do not save them to your computer or the cloud first. When your done, make a current Backup and you should good to go. Hope this helps. Good luck. Cheers.

  • How to export full image in PNG format lying inside a smaller sized rectangle?

    Hi
    In my own created extension for adobe inDesign using CS Extension builder 1.5, I am trying to export a page item lying inside a rectangle frame longer than frame height. Full image is not exported but it gets cropped which is of the rectangle height. I need to get full image exported in PNG format. The item can be text/image/drawing/or group of multiple items lying inside a rectangle frame.
    Sometimes the correct image is exported although the rectangle frame size is smaller than the inside image/item. Following is the code I’m using to export the page item.
    var targetItem:PageItem = pageItem.allPageItems[0];
    targetItem.exportFile(ExportFormat.PNG_FORMAT, targetFile, false);
    Can anybody help me out?
    Thanks and best regards
    Sal

    the answer is at : http://forums.adobe.com/thread/1060138

  • I am trying to use photomerge compose.  I open one standard jpeg image and one image that is my business logo in a png format.  When I select the png image, to extract the logo from it, it appears as all white and will not allow me to select the logo from

    I am trying to use photomerge compose.  I open one standard jpeg image and one image that is my business logo in a png format.  When I select the png image, to extract the logo from it, it appears as all white and will not allow me to select the logo from it.  It has worked in the past but I downloaded the update today and photomerge will not work correctly.  Any ideas?

    hedger,
    How do you expect anyone to help when we don't know a darned thing about the file, abut your setup, exact version of Photoshop and your OS, machine specs, etc.?
    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    a screen shot of your settings or of the image could be very helpful too.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • ICC profile to convert RGB to CMYK,   jpeg is ok, png format have a problem

    When I use ICC profile to convert RGB to CMYK, jpeg format is ok, but png format have a problem.the color is lossy.
    It means, the png file color is shallow than jpeg file after convert.Could anybody help me?
    thanks
    source code
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.util.Iterator;
    import javax.imageio.IIOImage;
    import javax.imageio.ImageIO;
    import javax.imageio.ImageTypeSpecifier;
    import javax.imageio.ImageWriteParam;
    import javax.imageio.ImageWriter;
    import javax.imageio.metadata.IIOMetadata;
    import javax.imageio.metadata.IIOMetadataNode;
    import javax.imageio.stream.ImageOutputStream;
    import org.w3c.dom.Node;
    import com.sun.image.codec.jpeg.ImageFormatException;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGEncodeParam;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    public class TestImage {
         public static void main(String args[]) throws ImageFormatException, IOException{
              BufferedImage readImage = null;
              try {
                  readImage = ImageIO.read(new File("C:\\TEST.jpg"));
              } catch (Exception e) {
                  e.printStackTrace();
                  readImage = null;
              readImage = CMYKProfile.getInstance().doChColor(readImage);
              writeImage(readImage, "C:\\TEST_after_.jpg", 1.0f);
        protected static String getSuffix(String filename) {
            int i = filename.lastIndexOf('.');
            if(i>0 && i<filename.length()-1) {
                return filename.substring(i+1).toLowerCase();
            return "";
        protected static void writeImage(BufferedImage image, String filename, float quality) {
            Iterator writers = ImageIO.getImageWritersBySuffix(getSuffix(filename));
            System.out.println("filename�F"+filename);
            if (writers.hasNext()) {
                ImageWriter writer = (ImageWriter)writers.next();
                try {
                    ImageOutputStream stream
                        = ImageIO.createImageOutputStream(new File(filename));
                    writer.setOutput(stream);
                    ImageWriteParam param = writer.getDefaultWriteParam();
                    if (param.canWriteCompressed()) {
                        param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);//NO COMPRESS
                        param.setCompressionQuality(quality);
                    } else {
                        System.out.println("Compression is not supported.");
                    IIOMetadata metadata = null;
                    if(getSuffix(filename).equals("png") || getSuffix(filename).equals("PNG")){
                         ImageTypeSpecifier imageTypeSpecifier = new ImageTypeSpecifier(image);
                         metadata = writer.getDefaultImageMetadata(imageTypeSpecifier, param);
                            String sFormat = "javax_imageio_png_1.0";
                            Node node = metadata.getAsTree(sFormat);
                            IIOMetadataNode gammaNode = new IIOMetadataNode("gAMA");
                            String sGamma = "55556";
                            gammaNode.setAttribute("value", sGamma);
                            node.appendChild(gammaNode);
                            metadata.setFromTree(sFormat, node);
                    writer.write(null, new IIOImage(image, null, metadata), param);
                    writer.dispose();
                    return;
                } catch (IOException ex) {
                    ex.printStackTrace();
    }

    Hi,
    I am having similar problems. I have read somewhere that png format can not handle CMYK colorspace anyway, which I find odd (and plainly stupid IM(NS)HO) which would mean that converting to RGB and therefore using profiles is mandatory.
    May be you should check if the internal format of the png files claims it is RGB or CMYK (using ImageMagick's "identify" command for example).
    HTH
    JG

  • Using PNG format with max width without clipping top and bottom of image?

    I am using PNG format to preserve the transparency and drop shadow I am trying to incorporate to give the illusion that this slab object is floating above the other layers.  I first tried file>place to position the menu object on edge of header/beginning of content.  Doing that leaves no options to force the image to span the width of whatever screen.  I need that so I've tried using object>fill> and then clicking the max width of the rectangle (which does solve the max width problem), but I am now dealing with a clipping problem of the top and bottom of the image.  The next thing I can think of is to go back to Photoshop and distort the image so it isn't as tall.  I feel there has to be a simpler way to accomplish this that won't also give my image a unnatural look.  Thoughts?  Thanks in advance.

    Thanks, that helps.  I also found that I cropped to much of the canvas.  After increasing the canvas area AND setting to fill all is well now.  I think your suggestion may help with the scrolling affect problem I'm having when using different resolutions. I am going to try to set the size in one dimension (height) so that different resolution screens see the same scroll actions.  Thanks Mylenium!

  • HT201317 My photos from iPhone 6 appear in PNG format instead of JPG.  How can that be changed?

    My photos from iPhone 6 appear in PNG format instead of JPG.  How can that be changed?

    When using iCloud to download them, you are going through the wrong procedure. That PNG file you are downloading is just the thumb nail. Open the image in the browser, then look to the menu at the top. you will see an icon that looks like a cloud with a downward pointing arrow. Click that to download the image.
    Syncing with Windows I can't help you with. I don't directly sync my iOS devices.

  • Red Illuminate on viewing PNG format in 10.9.4 update

    Hi everyone, I need a lil help. My MBP was updated to Mavericks 10.9.4, and however I found a problem when taking screenshots or viewing PNG format images.
    The problem is, I got some "illuminated red" on the images. Can anybody verify whether this is bugs from 10.9.4 update? Sorry for my English.
    As you can see from the screenshot, I got that red box illuminate.

    It could be malware that's causing the archive /  Top Sites problem.
    Download and run the adware removal tool here >   The Safe Mac » Adware Removal Guide
    Easy, safe, and only takes a minute or two.
    If no malware is found ...
    From your Safari menu bar click Safari > Preferences then select the Privacy tab.
    Click:   Remove All Website Data
    Then delete the cache.
    Open a Finder window. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari to test.
    If that didn't help, troubleshoot Safari extensions.
    From the Safari menu bar click Safari > Preferences then select the Extensions tab. Turn that OFF, quit and relaunch Safari to test.
    If that helped, turn one extension on then quit and relaunch Safari to test until you find the incompatible extension then click uninstall.

  • Acrobat will no longer covert PDF to PNG format

    Acrobat has functioned ok for about a year, then, when I needed to update some web pages, which look better using the PNG format, it refused to covert them from PDF.
    I tried all the obvious cross checks, different files different & directories etc, and even logged into my system (win 7 Pro) with another profile, still no luck.
    Did a repair, from the help menu - still not working.
    Re-insatlled from the disk, all worked OK for about a week or so, then failed again.
    any sugestions please?
    Error Message - could not save page - error attempting to save page - may be insufficient disk space
    Steve

    Hi Sukrit
    Seems all documents regardless of extension type, fail - Reinstall works for a time.
    The link you provided solved the problem - see below, must be a bug that will no doubt be fixed at the next update.
    This worked for me:
    - Go to "Save as other" select Image -> PNG
    - Click "Settings"
    - Under Color Management change RGB from "Embed Profile" to "Off" and accept
    Select destination, name and export.
    Regards
    Steve

  • How to save a selected word image to image file in open XML in PNG format?

    Hi Everyone,
    I have a very strange problem. I want to extract the image from word using open xml sdk. Here the user selects the image on opened word, and then clicks on any button, so it should extract the same selected image to any predefined location in the PNG format.
    I also tried to do the same thing using Word API, there I am copying the selection of image to clipboard and then getting the image and converting it to bitmap and saving it, but the image resolution is coming very bad. Is there any method through which
    I can save the image to file either by Open XML sdk or Word API using C#.
    Thanks,
    Shahab Abbasi

    Hi Shahab,
    To extract images from word document, please take a look at this thread:
    https://social.msdn.microsoft.com/Forums/office/en-US/e2a795ea-2ab7-401e-b6a8-0576220553f8/openxml-excel-how-to-extract-only-image-files?forum=oxmlsdk
    string fileName = @"C:\test.docx";
    using (WordprocessingDocument document = WordprocessingDocument.Open(fileName, true))
    var e = document.MainDocumentPart.ImageParts.GetEnumerator();
    int picNum = 0;
    while (e.MoveNext())
    picNum++;
    ImagePart imagePart = e.Current;
    Stream stream = imagePart.GetStream();
    long length = stream.Length;
    byte[] byteStream = new byte[length];
    stream.Read(byteStream, 0, (int)length);
    FileStream fstream = new FileStream(@"C:\abc.jpg", FileMode.OpenOrCreate);
    fstream.Write(byteStream, 0, (int)length);
    fstream.Close();
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Need help exporting large file to bitmap format

    I have a large file that I need to export to a bitmap format and I am experiencing unknown "IMer" errors, memory and file size limitations.
    The file contains only one artboard of size around 8000 pixels by 6000 pixels. I can successfully export as a png at 72dpi giving me a 100% image of my AI file. However I need to export an image at 200% of the AI file. If I export as a png at 144dpi to achieve this I get the following error(s)
    "The operation cannot complete because of an unknown error (IMer)" or "Could not complete this operation. The rasterised image exceeded the maximum bounds for savung to the png format"
    I have tried exporting as tiff, bmp and jpeg but all give "not enough memory"  or "dimensions out of range" errors.
    Does anyone know the limitations with AI for saving large files to bitmap format?
    Does anyone have a workaround I could try?

    You could try printing to Adobe Postscript files.
    This will actually save a .ps file and you can scale it to 200% when doing so. You'll need to "print" for every image change.
    Then open a Photoshop document at your final size (16000x12000 pixels) and place or drag the .ps files into the Photoshop document.
    I just tested this and it seems to work fine here. But, of course, I don't have your art, so complexity of objects might factor in and I'm not seeing that here.
    And you are aware that Photoshop won't allow you to save a png at those dimension either, right? The image is too large for PNG. Perhaps you could explain why you specifically need a png that large???

  • Photoshop CS3 .png format not appearing in the "Save As" drop down?

    I have been searching all over the internet and forums like this for a solution but have not come across one that works. I have tried installing an update for .png 8 bit and replacing the .png format file entirely, and to no avail. I'm sure all updates are there for my Photoshop CS3 because I just had my lap top worked on and they had to re-add my CS3, so I think that if any updates were needed they would have done that. I have worked with programs like Photoshop for awhile now but I do not know to much about it's inner workers (files, etc.) so I am not sure what the problem is, and I really need this fixed ASAP. I am working on work and I need that .png format. I can't do without it and .png shows up in the "Save For Web Devices", but I am using trasnparency and it is not doing any justice to my images.
    Windows Vista
    Adobe PhotoShop CS3
    15.7 GB free out of 105 GB
    I was working on Photoshop all day yesterday - no problem. Today, I can't get .png.

    Be very specific:  Does it say 10.0 or 10.0.1?  If the former, I recommend you visit this page and download and install the update:
    http://www.adobe.com/support/downloads/detail.jsp?ftpID=3775
    The plug-in should be here:
    C:\Program Files\Adobe\Adobe Photoshop CS3\Plug-Ins\File Formats\Png.8bi
    It should have a size and date of 98,304 bytes modified on Saturday, October 20, 2007, 8:11:42 AM EST.
    -Noel

  • Can we save our canvas as a .psd(photoshop) file? as we are saving with .jpg or .png format with the

     
                   I have 2-3 image in my canvas and i want to save it in .psd format means each image will act as a different layer when we will open the saved file in                  photoshop.
                    Thanks & Regards,
                    Parth

    no dear there is not any option as u suggested.
    rightnow i am using my canvas and making the bytearray of it and then I am saving this bytearray  with .jpg/.png format with the JPEG/PNG Encoders. but what it does? It makes a single .jpg file of canvas so if there are 3 images in it than it will save entier canvas as .jpg.
    I want to save each image as different layer and finally the canvas should be save in .psd format show i can open that .psd file in photoshop..
    thanks for the replies
    Thanks and Regards,
    Parth

  • Help frame is not opening to user, but displayed on the windows status bar.

    Hi All,
    In my application help frame is displaying on the windows status bar. But when i click on the icon it is not displayed on the desktop.
    This is not happening again to reproduce it.
    If you have faced this problem anytime, please let me know.
    May be a problem with the windows OS.
    In general, is there any case that, java Frame behaves like this?
    Regards,
    Nar

    Have you currently got private browsing enabled : Settings > Safari > Private Browsing 'on' ?

  • When I receive an email that contains a logo in a png format the logo is repeated twice.  Why is this happening in my email when it is not happening in other recipient's mail.

    When I receive an email that contains a logo in a .png format the logo is repeated twice.
    Why is this happening in my MAC maverick system when it does not happening in other
    MAC recipients' email?
    Nan

    WMP is a windows proprietary format.
    It is not supported on iOS devices.
    QuickTime player is built into ios and used for all video playback-nothing is being converted.
    You can try downloading an alternate player that can playback wmp or use a computer.

Maybe you are looking for

  • Maverick HP Officejet Pro 8500 Wireless - Scan is black after saving

    it seems to be a common issue that after a major release upgrade the same issues come up again which are already solved in former releases. It's a pity that there is no learning effect. After my upgrade to Maverick the Wireless AnyConnect VPN didn't

  • Can I create a portfolio slideshow using custom thumbnails?

    Hi. After searching the forums and watching several Lynda tutorials, I can't seem find an answer to my specific question. I'm creating a new portfolio website for myself and for the actual portfolio page, I went ahead and created custom thumbnails fo

  • Range partitioning does not work the way I thought it would

    I have a table that is range partitioned by number. The number represents a date field of the form: YYYYMMDDHH24 However, there are extra values on the end of the field that represent an exact datestamp so a record looks like 20071102100000001 What I

  • Changing sap icons

    Does anyone know how do I change a sap icon ?? for example if I want to change the icon of WORD to another view how do I do it ?? Regards, Menachem Roth

  • PrePrint event scope affects all other print events?

    A PDF requirement is to have one document print in different versions for different recipients -- e.g., court, DA, public defender .. They aren't all allowed to see the same data on people in the system, and in one instance, the form must be secured