Jpeg or gif inside JPanel

how do i put an image into a JPanel ?

If you're using Swing, then look into using an ImageIcon inside a JLabel. If not, then load the gif or jpeg into an Image instance and overriding the paint() method of a panel.

Similar Messages

  • Photoshop CS6 Saving JPEGs as GIF's???

    I am doubble clicking my .jpg images from Bridge CS6 into Photoshop CS6 to downsize the image and after i change the image to move across to a forum elsewhere.
    The Save As" option gives me all the normal file. options, i click the drop down bar and select JPEG, and then automatically the .jpg image above turns into a .gif file???
    I have closed out and tried resaving on several different images of mine and keep getting this .gif once selecting the JPEG, and- .gif setting if i select ok to go forward with the.gif.
    I want to save as a simple
    JPEG with a size 8 for web forum purpose.
    Whats with this?
    Please help with this, is it a bug??
    Thanks
    Here is the screen pic.-->
    Sorry about the blurryness if you click the image it wil enlarge. Cheers
    OSX
    10.6.8
    CS5 Master Collection Suite Owner &
    Lightroom 4.
    ******UPDATE- Going through all different file formats, saved everything as something different.
    Saving my image as .Photoshop Raw- Saved my Photo as a JPEG then i got to choose size 8 - ok. Done.
    Definatley a BUG!!***** in file saving!!!******

    To be perfectly clear, you CAN use the Extra Plug-ins Folder specification to point to a separate folder you've created where you have put ONLY your 3rd party plug-ins.  It can be a neat way to help organize plug-ins, especially if you don't prefer to copy things into your Photoshop installation area.
    Just don't point it anywhere in the installation area for another version of Photoshop.
    The basic problem is that many folks, in trying to save time, choose to point their Extra Plug-ins Folder setting to the plug-ins subfolder inside their old Photoshop installation area, thinking that will just make them all available to the new version.  The key thing is that the old versions of Photoshop ALSO had put their own Adobe-supplied plug-ins there.  The conflict arises when the new version of Photoshop starts and tries to enumerate the plug-ins, including those found in the Extra Plug-ins Folder, it finds overlap between its own plug-ins and the old ones it finds there.
    -Noel

  • Jpeg to gif ( too many color exception !)

    Dear all :
    I want to convert a jpeg file to gif file (no need to animation's one ) using java . I have found a source program (GIFEncoder ) that convert the image to the gif file . But when i using the class to convert a jpeg to gif, a ' too many color exception ' has return . It is not diffcult to think why the exception happen , it is because the jpeg is always represent in true color (24 bits) , while the gif can only display 256 color (8 bits) . so , i have no ideas that how to create a 256 color jpeg using java ? because the JPEGEncoder package provided by sun will create a 24 bits jpeg file .The JAI can't create the gif files as the animation features of gif files .
    So anyone can teach me the ways of how to create a 256 color jpeg using java , or a suggestions that create gif file using java ?
    Thanks in advance !

    Here's how I do it (it's not based on a color theory or anything, it's just the first thing that came to my mind when I needed this functionality in one of my applications):
    I set up a table with the 256 most frequently appearing colors in the image. Sometimes, these colors are too similar, so I use a little algorithm that makes sure that the colors are satisfyingly different. The algorithm takes a parameter (the color dispersion parameter) and works according to the following pseudocode:
    for all colors in the palette do:
    differential = 0;
    differential = abs(oldColor.red - newColor.red) + abs(oldColor.green - newColor.green) + abs(oldColor.blue - newColor.blue);
    if differential < color dispersion parameter
    don't add new color
    If the new color passes this test, it is added to the palette. Depending on your needs, you may want to let the user select the degree of "color dispersion". If the palette doesn't contain 256 colors after this first pass, I decrease the color dispersion parameter by one and loop over the colors again (keeping the palette from the first pass of course). When this parameter reaches 0, there must be 256 colors in the palette, or the picture wouldn't need to be converted.
    Then make an IndexColorModel from your palette data and set up a MemoryImageSource. From this you can create your image and do whatever you want with it.
    Hope this helps!

  • IPhoto won't import jpeg or gif, or any common photo types, from backup CD

    I recently had my hard drive replaced. I had backed up all of my photos on a CD, but iPhoto gives an error message when I try to import some of the jpegs and gifs to the new HD: "The following files could not be imported (they may be an unrecognized file type or the files may not contain valid data". Is this a software issue?

    Back up your iPhoto library, Depress and hold the option (alt) and command keys and launch iPhoto - rebuild your iPhoto library - start at the first option and try each one in order
    LN

  • Changing JPG to JPEG or GIF & resizing

    I'm trying to post my pictures on a website, but the're in JPG and the website only allows JPEG or GIF. How can I change the images, and how can I make them smaller, i've tried making them smaller to export, but they still end up big, so I need another option rather than exporting. Please help.

    Christina:
    Welcome to the Apple Discussions. To resize for other applications just select those you want to resize and use the File->Export->File Export route. There you will have the option to select the size you'd like.
    As for the JPG vs JPEG, have you tried submitting a JPG file? Those two extensions are the same and can be used interchangeably. The JPEG is the more formal representation of that format. If the simple JPG extension is rejected you can use R-Name to batch change the extension to JPEG before you submit them to the site. You'll have to do that after you export from iPhoto.
    OT

  • Can I make a non-flash slide show using Fireworks, with JPEGs not GIFs?

    Can I make a non-flash slide show using Fireworks, with JPEGs not GIFs?

    Look to using jQuery instead of Flash.  There are a variety of redy-made solutions available, just search Google or visit the Dreamweaver forum and ask there.

  • Why won't jpegs and gifs open

    Can anyone tell me why jpegs and gifs that are in a document created in Word for Windows won't open in Word for Mac. This is a huge problem for me because I have webpages that I created in Word for Windows and when I edit them in Word for Mac I loose the graphics.

    Word for Windows is a really poor webpage editor. It assumes everyone in the world uses Internet Explorer, and does not take the precautions of following standard HTML coding. A webpage document created in word may work in only Internet Explorer and maybe a few other web browsers.
    My suggestion is to learn HTML and/or use a webpage editor known to follow w3.org standards to the letter like http://www.barebones.com/ BBEdit. You can try several other web browsers for the Mac as well:
    http://www.macmaps.com/browser.html
    Disclaimer: Reference to links I make to my Macmaps.com website are a for your information only type reference. I do not get any profit from this page, and it is open to the public.

  • Save Graphics2D to a jpeg or gif file...

    Hi.
    I'm trying to save a drawing in a image file format, like jpeg or gif. But i don't have a clue how to do that.
    Can any one help? Urgent!!
    Thanks!
    M�rio Dagot

    import java.awt.image.BufferedImage;
    import com.sun.image.codec.jpeg.*;
         // in paint
         BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
         Graphics2D biContext = bi.createGraphics();
         biContext.drawImage(image, 0, 0, null);
         saveAsFile(bi);
    public void saveAsFile(BufferedImage img) {
      //Create a fileoutputstream.
      FileOutputStream fos;
      try {
            fos = new FileOutputStream(
                  "c:\\nameOfImageFileToSave.jpg");
            JPEGImageEncoder encoder =
              JPEGCodec.createJPEGEncoder(fos);
            encoder.encode(img);
            fos.flush();
            fos.close();
            catch(FileNotFoundException e) {
                 System.out.println(e);
            catch(IOException ioe) {
                 System.out.println(ioe);
    }//end saveAsFile

  • How to compress image files, jpeg, bmp, gif, png, tiff, etc

    I am new to Jave imaging, does anybody know how to compress an image file, including jpeg, bmp, gif, png, tiff format.
    Thanks
    JC

    some are already compressed.
    If you just want generic compression, it doesn't really matter what type of file they are. A simple approach would be to use ZipOutputStream

  • Jpeg and gif images are not fuzzy

    How can I import jpeg and gif files so that they are crisp and not fuzzy?  I have Lifecycle Designer 7.0
    T

    Look at the bottom of this page as well [http://carlback.blogspot.com/2007/12/apex-and-3rd-party-js-libraries.html]
    Patrick Wolf
    Carl,
    the only drawback with #WORKSPACE_IMAGES# and #APP_IMAGES# is that it doesn't get cached by the browser. So each page request will transmit the hole file again. A caching option for the "Static Files" in the Shared Components would be nice :-)
    About lazy loading with the #WORKSPACE_IMAGES#. I could think about a mod_rewrite rule which translates the additional file request of the JS library into a valid request for APEX.
    Carl Backstrom
    In 3.1 we emit a last modified header now for uploaded files so that should help with browser caching.
    I wonder if anything's changed since then.
    Kofi

  • Putting jpegs and gifs into an applet???  - new programmer

    I am a new programmer trying to learn how to put jpegs and gifs into my applet. I am using a paint method to draw pictures. Is there a way that I can insert jpegs and gifs into this at certain x and y coordinates?
    Thanks.

    http://java.sun.com/docs/books/tutorial/uiswing/painting/usingImages.html

  • Can video can be shown inside JPanel ?

    Can video can be shown inside JPanel ? is there any example can do this ?

    Several information can be found on this topic.
    You can add video on JFrame, JInternalFrame so why not on JPanel ?
    For more information you can shearch examples in the Sun's JMF examples.
    I try to use video in JInternalFrame, but the frame rate is very bad ... so if you have solution... your are welcome.
    Good luck!

  • Animated .gif in JPanel

    Hello,
    I'm trying to render an animated .gif in a JPanel. I'm overriding paintComponent as follows:
       public void paintComponent(Graphics g)
          super.paintComponent(g);
          // center the background image.
          //backgroundImage is an Image
          if (backgroundImage != null)
             g.drawImage(backgroundImage, (this.getWidth() - backgroundImage
                   .getWidth(this)) / 2, (this.getHeight() - backgroundImage
                   .getHeight(this)) / 2, this);
       }The problem: I'm only getting the first frame displayed. What do I need to do to properly display the animated image?
    Thanks.
    Marc

    Adding a JLabel is not convenient, nor is it the proper way to do it. The panel has other components and coming up with a layout manager that will overlay components is not the proper thing to do.
    Creating a Thread is also not the proper thing to do.
    I found a solution that works fine. Instead of using an Image, I create an ImageIcon and use that to display the animated gif.
       public void paintComponent(Graphics g)
          super.paintComponent(g);
          // center the background image.
          // backgroundImage is an ImageIcon
          if (backgroundImage != null)
             g.drawImage(backgroundImage.getImage(), (this.getWidth() - backgroundImage
                   .getIconWidth()) / 2, (this.getHeight() - backgroundImage
                   .getIconHeight()) / 2, this);
       }Thanks for your help.

  • Jpeg to gif conversion

    Hi;
    I want to convert jpef or png images to gif format, but I have a problem.I'm using a gif encoder and normally I can convert jpeg files to gif files when jpeg files are 256 colors.
    When I try to convert 65000 or more coloured jpeg or png files it gives error and said gif files can not contain more than 256 colors.
    How can I change the loaded images color?Decrease to 256?
    Regards
    Murat

    A gif can only have 256 colors, trying to put more colors in it is an error.
    If you want more colors use png.
    Converting a jpeg to a gif is normally a bad idea. Gif and png compress drawing good, but photos bad, jpeg is the opposite.
    So gif->jpeg normally gives you a file that is a lot bigger for the same quality.

  • Photoshop CS5 save animation as jpeg - not gif?

    My content management system will only allow jpgs for this particular section of my site that I'm working in. I have PS CS5 Extended and I already created my animation (basically just a slideshow) and now I need to save it as a .jpg.
    I tried doing Save for web and devices, selecting GIF as the format and then changing it to a jpg extension. This preserves the animation and also gives it the file type that I need. However the gif image quality is awful.
    I remember doing this at point a few years ago but forgot how I did it! Another option was under export, render video I believe, but that just creates hundreds of jpgs and not just one.
    Thanks

    The JPEG format itself does not support animation, though the HTML on your site could change the src attribute of your IMG elements, for example with a script.  I have done exactly that - I have a small Javascript that rotates multiple JPEGs on my own web site (http://www.ProDigitalSoftware.com).  View source to see the simple Javascript.
    Are these large images? Are they photos or drawn graphics?
    You're not going to get good photo quality with GIF because it's an indexed format that can carry at most 256 colors, and if you're spreading those colors across multiple frames then you'll see even further degradation.
    -Noel

Maybe you are looking for