N97 Amimated GIFs

In the photo app animated .gif files animate very, very slowly. So slowly in fact that I thought they were not animating at all.
I have one made of of 40 frames and should loop the animation each second and the photo app takes about 5-10 seconds for each frame.
Also: When setting an animated .gif as wallpaper, it is not animated at all.
Anyone else got these issues?
UK, Vodafone, launch firmware.

You do realize that animated GIFs don't animate themselves right? The application opening the file has to "animate" it by rotating through the series of images or image differences.
The animated GIF file format was developed by CompuServe as an extension to their GIF format. It is backward compatible to GIF but is a different format by itself. So supporting GIF doesn't mean you have to support the animated extension.
Nokia supports GIF for Wallpapers, not animated GIF, that's why it only shows the first frame. Could be to conserve battery life, since performing the animation would require the processor to run and continuously update the screen.

Similar Messages

  • More N97 Questions!

    Oh yes, more questions about Nokia's infamous flagship phone the N97!
    Background
    I've had my phone little over 2 weeks now and at first I was very impressed - the specs are good and the feel of the phone is superb!
    However like all N series Nokia's this too has had the same faults as previous N series phones! - my previous phone was the 5800 and although i liked this phone when the N97 was released I had to get it although in the back of my mind I was thinking it's going to be slow and crash all the time....
    In comparison to the 5800 this phone is a lot slower at processing this (simple things like booting up and it's slower, slow tranistions and bugs with the new fancy widgets they have included)!
     Question1:
    When the phone is locked and I receive a call it comes up on the screen with the answer or unlock buttons (gifs)?
    Recently I have missed a few calls because I have tried to answer the call by pressing the button on the screen (when the phone is locked) however nothing happens... then when I try to unlock it nothing happens meaning that I've missed the call!
    Question2:
    Is there anyway of having email automatically connected?
    I use my personal email on my phone and obviously it doesn't come through unless I connect to it manually - is there anyway of changing this to make it automatic?
    Thanks in advance
    Solved!
    Go to Solution.

    Q1
    See the onscreen prompts when a call comes in.
    To accept and answer the call follow the prompt, and swipe the green, flashing "Answer"  ticker to the right (in the direction of the arrow).
    To unlock the touch screen, so you can get more options to choose to accept and answer, or to reject the call, swipe the blue flashing "Unlock" ticker to the left (in the direction of the arrow).
    Q2
    I have my email widget on my homescreen.
    With your email account on the screen, go to:-
    Options
    Automatic retrieval
    Set it to what you want
    Message Edited by 2bad on 13-Jul-2009 12:02 PM

  • N97 Mini screensaver settings

    Hello
    The technical details for the N97 Mini say that it has screensaver capabilities but I can't find the settings for this anywhere.
    I have downloaded some free themes from the Ovi store which claim to have screensavers with them but they don't seem to do anything. After about 30 seconds the screen just goes black.
    I can change the length of time it takes for the screen switches itelf off but this doesn't make a screensaver appear.
    Any ideas?

    The N97 mini doesn't support animated screensaver. I tried using a gif image as wallpaper but I wasn't rewarded with a fanciful screen. But what the heck, animation will just increase the demand for my battery power. I'm fine without it.
    I came here looking for answers, I ended up offering some...

  • N97 MfE Proxy Settings

    N97
    Firmware v11.0.021 15/06/2009
    MfE 2.09.162
    MfE works when I use a WiFi access point, but it doesnt work when I use packet data access point
    My packet data access point is a corporate APN, and that APN uses a Proxy to connect to the Internet
    MfE trouble shooting guide suggests that you should not use Proxy settings with MfE
    N97 connects to the data access point, but fails to establish connection through the Proxy to our corporate Exchange server, get error message in the MfE logs 'HTTP Server Error 408 Request Timeout'
    A colleague has same problem with an N95, however an E series phone does work
    Is this a problem only with N series
    Help appreciated

    The N97 mini doesn't support animated screensaver. I tried using a gif image as wallpaper but I wasn't rewarded with a fanciful screen. But what the heck, animation will just increase the demand for my battery power. I'm fine without it.
    I came here looking for answers, I ended up offering some...

  • Open and edit animated .gif while preserving frame timing

    CS4 Premium Design Edition, Win XP
    I was disappointed with the removal of Image Ready from CS3 because although some of the functionality was placed into Photoshop 10, there was no way to open and edit an existing animated .gif while preserving the timing of each individual frame. I was told on the PS forum at the time that I really needed to use Fireworks. I resented that, because I was very happy with Image Ready and I didn't want to have to learn a new application just to gain functionality that had been included in previous versions of PS/IM.
    I've now got CS4 Premium Design Edition which of course includs Fireworks... and here's what Help has to say on the subject of imported .gifs.
    "Note: When you import an animated GIF, the state delay setting defaults to 0.07 seconds. If necessary, use the States panel to restore the original timing."
    This is no use to me. What if I don't know the individual frame timings? What if there are 200 frames with varying timings?
    Simple question: which current Adobe product is capable of importing a .gif while retaining the frame timings? If anyone knows, or if I've misunderstood the nature of the Fireworks Help quote above, I'd really appreciate some input here. Thanks :)
    Not so simple question: why was an excellent gif-editing application thrown out to have its functionality partially replaced by a bunch of scripts and half-effective workarounds cooked up by desperate users ("import a gif by using the video import and typing *.* into the filename box..")? It's a fair question I think.
    Mark

    Hi Bob, that's not glib at all, it's a reasonable question.
    I uninstalled it along with everything else when I installed CS3, in the reasonable expectation that whatever replaced IR would be at least equal in functionality.
    Perhaps I should just dig out CS2 and install IM from there, but I have some serious reservations about doing so, because I don't know if/how a partial install of CS2 will impact upon my installation of CS4, and I'm not confident of getting support.
    I am also curious to know if/why Adobe actually removed basic functionality without replicating or replacing it in their other software. I really want to know: which recent, currently supported Adobe product
    should I be using in order to regain this functionality? Or do Adobe no longer produce a geniuinely comprehensive .gif-editing application?
    Mark

  • Published GIF Problems!  Please help

    I've created a flash animation and published it as a GIF
    animation that continuously loops. After previewing my GIF there
    are black blocks wherever there is TEXT. Anyone know how to fix
    this? I've never encountered this problem before so I have no idea
    how to fix it...

    OK I found a way around this problem... I delete all the text
    that I had created within Flash and recreated it in Photoshop. I
    rasterized the type in Photoshop the I saved the files as PSD. I
    then went in to Flash and imported them to the library. I place the
    images of the text where they had originally been in my Flash file.
    When I published it as an animated GIF the file was perfect... No
    Black or White blocks...
    SO you might try that... I'm not sure what Flash changed, but
    I used to create text for animiated gif before without any
    problems...

  • Animated GIF ignoring frame timing

    I am trying to create simple animated GIFs with a few layers
    of text that simply fade in and fade out in sequence. My initial
    attempt worked perfectly. Most frames use the default 7/100's of a
    second delay as they fade. A few frames were manually set to much
    longer delays so that the text pauses, before fading out to be
    replaced by the next text.
    When I reopened the file, to adjust the background color, and
    then re-saved it, the GIF now plays straight through, ignoring the
    timing of each frame. Nothing I do now can get it to pause on the
    appropriate frames. I've tried cutting the symbols out and pasting
    them into a new file, removing the animation from the symbols and
    reapplying it, etc.
    Any ideas, anyone?
    Thanks in advance.

    None, None.

  • Edit animated gif

    Hi,
    How can I edit an animated gif in Photoshop Elements 6 for Mac?
    When I open the file there is just the first frame in one layer - no other layers available.
    Thanks!

    Thanks Barbara!
    Barbara B. wrote:
    ... then bring it to PSE.
    I can't drag the single frames from Preview to PSE, because PSE 6 doesn't run in window mode.
    (Is this improved in the current version?)
    I can only drag the single frames to the desktop (as TIFF files, I guess transparency info is lost then?).
    Barbara B. wrote:
    ... there's a bug beginning in PSE 6 where you can't change the frame delay rate from the default when you save an animated gif.
    What's the default frame delay rate? Maybe it's just what I need.
    Barbara B. wrote:
    You might  want to look into a free program like giffun from stone.com instead.
    Yes that's maybe a better idea. It doesn't have to be free software. Can you recommend something good?
    Thanks again!

  • Can i open and edit animated GIF in Adobe Photoshop Touch?

    Can i open and edit animated GIF in Adobe Photoshop Touch?

    No, only regular static GIF images are supported. The desktop version of Photoshop does support this however.

  • Gif animations in Mail

    I've read some threads about this problem, and while there is lively debate, there doesn't seem to be an answer. So I thought I would try it again with a new question.
    A friend of mine (he has an old IMac) forwarded me an email with an animated gif. It was funny, and I wanted to forward it on. But I have never been able to do this. If I try to save the file, it saves as a MIME attachment, and I can't even open it. If I Download the file, the Get Info says it is a gif file, but if I open it in Preview, or attach it to a new email, it no longer animates and is just a still picture.
    I tried forwarding the original email with the animated gif back to myself, and when it arrives, it no longer animates. My friend is no help. He's not really in to computing. He told me he just gets them from somebody else, and forwards it to me.
    So why can I see the animated gif in my Mail, but can't save it, download it, cut & paste it, or forward it? I tried the Append Message suggestion from an old post, and that did not work either.
    I noticed in some of the old posts some people seem to really hate gif's. I don't really care one way or the other. I just want to understand why my computer can receive them, but can't do anything else with them.

    Although Jaguar and Panther Mail renders HTML received, they do not support composing HTML which also includes when forwarding a message received that was composed in HTML including animated gifs.
    Although you cannot compose complex HTML within the body of a message with Tiger Mail, RTF with Tiger Mail is HTML and supports forwarding a message received that was composed in HTML including animated gifs.
    Reason for this: if you automatically render all HTML received (with any email client with OS X) and a spammer uses HTML for message composition and includes embedded images or objects that must be rendered from a remote server, if the Mail.app Junk Mail filter does not automatically mark the message as junk and you open the message, this can reveal that your email address is valid to the spammer causing more spam to be received.
    Copied from Why HTML in E-Mail is a Bad Idea:
    "Because it introduces accessibility problems. When you write in plain text, the receiving mail client renders the text in whatever font the reader chooses. When you format email with HTML, the sender controls the formatting. But this is a trap: You only think your message will render the same way to the viewer as it appears to the sender. In reality, the receiver can end up squinting because the font looks so tiny, or vice versa. HTML is not rendered the same way from one viewing client to the next - all guarantee of accessiblity goes out the window. This is especially problematic for visually impaired persons."
    Because it can introduce security issues and trojan horses -- it's a gateway to danger as any Outlook user can tell you. HTML can include any number of scripts, dangerous links, controls, etc.
    Powerbook G4 17"   Mac OS X (10.4.5)  

  • Animated GIFs are ridiculously large - why?

    Hi all,
    I cannot figure out why the animated GIFs I am exporting are
    so massive in file size. For example, I import a small 5-frame
    650Byte GIF. I edit the size of the canvas to pad it to a square
    (from 54x40 to 54x54, or something like that), then I save it with
    the following settings:
    Animated GIF
    Exact Palette
    0 Loss
    4 Colours (5 including alpha channel)
    No dither
    And it comes out as 64.4KB. How can the file size increase by
    100 times with barely any change? Even if I import it, change
    nothing and save the file with the same settings as above, it's
    still 64.4KB. Is Fireworks padding the file with unnecessary
    information or something?
    Thanks for any help,
    John.

    > But the original image is an animated GIF and it's less
    than 1KB big! So
    > how
    > does it increase in size 100 times when I save it
    even if I don't
    > change
    > anything about the image before saving? There is no
    PNG file but I can
    > link
    > you to the original 650 Byte Animated GIF:
    I'm confused. What is this I am looking at. What have you
    done to it to
    make it increase in weight?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Quircus" <[email protected]> wrote in
    message
    news:g6fohk$mip$[email protected]..
    > But the original image is an animated GIF and it's less
    than 1KB big! So
    > how
    > does it increase in size 100 times when I save it
    even if I don't
    > change
    > anything about the image before saving? There is no
    PNG file but I can
    > link
    > you to the original 650 Byte Animated GIF:
    >
    >
    http://www.aotplaza.com/Prod.gif
    >
    > Is it something to do with my settings perhaps? Like
    telling it to save
    > extra
    > information in the file?
    >

  • Gif not animating when on the Internet

    Hopefully some one can help as I have tried everything i can
    think of
    I have create a animation using Flash 8 I have exported this
    as a Animated gif to my computer. I can open the file and it
    animates fine on my pc. When i upload to myspace it does not
    animate.
    I have tried downloading a random gif from the net and
    uploading it to myspace and this animates (Just wanted to check
    Myspace works with gifs)
    The problem only appears to be with animations I have made.
    I have tried making a really small animation (about 110kb)
    then uploading it to myspace but again it doesnt animate (so its
    not a size issue)
    Flash - I have tried exporting movie as a gif and publishing
    as a gif. The Animation has been made using motion tweed and not an
    action script and I have tried every combination of gif option i
    can think of i.e loop animation, loop twice, changing the frame
    rate, size , colours, transarency etc
    Please help as im so confused as to why this doesnt work.

    Perhaps Safari isn't quite what you require, too much work involved all the time making it easier to see
    Take a look at my customized Firefox:
    it always opens to the same size window (or full screen if you like)
    it always zooms all web pages 160% (or whateve you like)
    it always has large type on the menu bar area. (to whatever you like)
    it's very highly customizable,  (or use the plain default settings)
    has more add-ons than anyone (a real plus when you need it)
    has more themes and personas than anyone (make it YOUR browser)
    Easier surfing option for hard of seeing users
    Safari is about the absolute worst browser since Internet Explorer, it's because Apple has already got your money so there isn't any incentive for them to make a better browser.

  • Gif Animations

    First off, I'd like to say I've been making gif animations in Photoshop Elements since 2.0, and I've had no problem with 6.0 either--- when I was on Windows.
    For whatever reason, when I open a .gif animated image, I get an error message that says:
    "This is an animated GIF. You can only view one frame. Saving over this file will result in a loss of information."
    EVERY single time I open a gif, and as soon as I hit okay, it opens to the single frame locked. As I said, I've never had this problem with Photoshop Elements 6.0 in Windows... Any suggestions/ help please?

    Your post is unclear on some important points. When you say "when I was in Windows" does that mean you are talking about a mac now? What version of PSE are you talking about?
    If you mean PSE 8 for mac, you would be better off downloading a program like the free Giffun from stone.com and using that for animated gifs. For one thing the frame rate has been broken in the mac version of PSE in both 6 and 8.

  • .gif preview slow in Save for Web

    I am having an issue in Save for Web where the .gif animation preview works very slow and choppy. I am an advertising designer and many times I need to work on animated .gif banners. I am working with Photoshop CS6. When I play the animation in the frame timeline the animation speed works as intended, a little choppy but the timing isn't too bad. However when I go into the Save for Web screen and play the animation it always appears a lot slower and looks choppy. Anything se to 0.0 or No Delay runs as if its set to .1 seconds. Now if I export the file and open it in Chrome the animation speed seems to go back to normal. This wasn't always the case, I tested this 2 or 3 months ago and the animation speed in the export was also slow and choppy but it must have been fixed in one of the updates since then.
    My issue is I don't want to have to preview everything in Chrome after I export it, and then possibly have to go back and tweak it then save again, preview again etc. I have never encountered this issue in previous versions on Photoshop or other machines. Ususally my experience has been the opposite, the frame timeline has always been slower, but previewing in Save fro Web has shown a pretty accurate preview.
    I also have a HP laptop running Windows 7, photoshop CS6 and I don't encounter this issue at all. It seems that everyones default answer on all of the forums is "different browsers handle .gif animation speeds differently, etc.." but int he past I have saved a .gif on my mac and it was slow and choppy in the Chrome, then I saved the same file on my PC transfered it back to the mac and previewed in Chrome and the animation played quickly and smoothly.
    I can't see it being a hardware issue because the machine I am using is farily new. iMac Late 2013/2013, 3.4 Ghz Intel Core i7, 16GB RAM, NVIDIA GeForce GTX 675MX 1024 MB, running OSX 10.8.4 Mountain Lion.
    Could it possibly be a setting or preference that needs to be changed? As I stated above it seems that now when I export the animation works fine in the browser the preview is just slow, but I have read that many people are having this issue so hopedully someone will have a solution.

    I don't use a Mac but the first the first thing I do when I have performance problems with Photoshop on my PC is to do some house cleaning.  I reset my Photoshop Preference to a saved copy I made when Photoshop was working well.  I Also clean my disk up clearing caches and temp files so the plenty of scratch space.  I close all applications and look at the machine CPU utilization. Then try Photoshop to see if it is back to its normal performance.

  • GIF decoding

    This works on WinXP but not Linux. Why? It takes the first frame of an animated gif and writes a thumbnail.
                GifDecoder d = new GifDecoder();    
                try {
                    fis = new FileInputStream(file);          
                    bis = new BufferedInputStream(fis);            
                    log.debug("reading gif");
                    d.read(bis);
                    log.debug("reading framecount");
                    int n = d.getFrameCount();
                    log.debug("read framecount" + n);
                    for (int i = 0; i < 1; i++) {
                        BufferedImage frame = d.getFrame(i);  // frame i
                        int t = d.getDelay(i);  // display duration of frame in milliseconds
                        log.debug("resizing frame");
                            File gifoutputfile = new File("gif" + i + outputthumbFilename);
                        BufferedImage bdest = new BufferedImage(60, 60, BufferedImage.TYPE_INT_RGB);
                        Graphics2D g = bdest.createGraphics();
                        AffineTransform at = AffineTransform.getScaleInstance((double) 60 / frame.getWidth(), (double) 60 / frame.getHeight());
                        g.drawRenderedImage(frame, at);
                        ImageIO.setUseCache(false);
                        ImageIO.write(bdest, "GIF", new File(outputthumbFilename));           
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
    import java.awt.AlphaComposite;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    import java.awt.image.BufferedImage;
    import java.awt.image.DataBufferInt;
    import java.io.BufferedInputStream;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.net.URL;
    import java.util.ArrayList;
    * Class GifDecoder - Decodes a GIF file into one or more frames. <br>
    * <pre>
    *  Example:
    *     GifDecoder d = new GifDecoder();
    *     d.read("sample.gif");
    *     int n = d.getFrameCount();
    *     for (int i = 0; i < n; i++) {
    *        BufferedImage frame = d.getFrame(i);  // frame i
    *        int t = d.getDelay(i);  // display duration of frame in milliseconds
    *        // do something with frame
    * </pre>
    * No copyright asserted on the source code of this class. May be used for any
    * purpose, however, refer to the Unisys LZW patent for any additional
    * restrictions. Please forward any corrections to [email protected].
    * @author Kevin Weiner, FM Software; LZW decoder adapted from John Cristy's
    *         ImageMagick.
    * @version 1.03 November 2003
    public class GifDecoder {
       * File read status: No errors.
      public static final int STATUS_OK = 0;
       * File read status: Error decoding file (may be partially decoded)
      public static final int STATUS_FORMAT_ERROR = 1;
       * File read status: Unable to open source.
      public static final int STATUS_OPEN_ERROR = 2;
      protected BufferedInputStream in;
      protected int status;
      protected int width; // full image width
      protected int height; // full image height
      protected boolean gctFlag; // global color table used
      protected int gctSize; // size of global color table
      protected int loopCount = 1; // iterations; 0 = repeat forever
      protected int[] gct; // global color table
      protected int[] lct; // local color table
      protected int[] act; // active color table
      protected int bgIndex; // background color index
      protected int bgColor; // background color
      protected int lastBgColor; // previous bg color
      protected int pixelAspect; // pixel aspect ratio
      protected boolean lctFlag; // local color table flag
      protected boolean interlace; // interlace flag
      protected int lctSize; // local color table size
      protected int ix, iy, iw, ih; // current image rectangle
      protected Rectangle lastRect; // last image rect
      protected BufferedImage image; // current frame
      protected BufferedImage lastImage; // previous frame
      protected byte[] block = new byte[256]; // current data block
      protected int blockSize = 0; // block size
      // last graphic control extension info
      protected int dispose = 0;
      // 0=no action; 1=leave in place; 2=restore to bg; 3=restore to prev
      protected int lastDispose = 0;
      protected boolean transparency = false; // use transparent color
      protected int delay = 0; // delay in milliseconds
      protected int transIndex; // transparent color index
      protected static final int MaxStackSize = 4096;
      // max decoder pixel stack size
      // LZW decoder working arrays
      protected short[] prefix;
      protected byte[] suffix;
      protected byte[] pixelStack;
      protected byte[] pixels;
      protected ArrayList frames; // frames read from current file
      protected int frameCount;
      static class GifFrame {
        public GifFrame(BufferedImage im, int del) {
          image = im;
          delay = del;
        public BufferedImage image;
        public int delay;
       * Gets display duration for specified frame.
       * @param n
       *          int index of frame
       * @return delay in milliseconds
      public int getDelay(int n) {
        delay = -1;
        if ((n >= 0) && (n < frameCount)) {
          delay = ((GifFrame) frames.get(n)).delay;
        return delay;
       * Gets the number of frames read from file.
       * @return frame count
      public int getFrameCount() {
        return frameCount;
       * Gets the first (or only) image read.
       * @return BufferedImage containing first frame, or null if none.
      public BufferedImage getImage() {
        return getFrame(0);
       * Gets the "Netscape" iteration count, if any. A count of 0 means repeat
       * indefinitiely.
       * @return iteration count if one was specified, else 1.
      public int getLoopCount() {
        return loopCount;
       * Creates new frame image from current data (and previous frames as specified
       * by their disposition codes).
      protected void setPixels() {
        // expose destination image's pixels as int array
        int[] dest = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
        // fill in starting image contents based on last image's dispose code
        if (lastDispose > 0) {
          if (lastDispose == 3) {
            // use image before last
            int n = frameCount - 2;
            if (n > 0) {
              lastImage = getFrame(n - 1);
            } else {
              lastImage = null;
          if (lastImage != null) {
            int[] prev = ((DataBufferInt) lastImage.getRaster().getDataBuffer()).getData();
            System.arraycopy(prev, 0, dest, 0, width * height);
            // copy pixels
            if (lastDispose == 2) {
              // fill last image rect area with background color
              Graphics2D g = image.createGraphics();
              Color c = null;
              if (transparency) {
                c = new Color(0, 0, 0, 0); // assume background is transparent
              } else {
                c = new Color(lastBgColor); // use given background color
              g.setColor(c);
              g.setComposite(AlphaComposite.Src); // replace area
              g.fill(lastRect);
              g.dispose();
        // copy each source line to the appropriate place in the destination
        int pass = 1;
        int inc = 8;
        int iline = 0;
        for (int i = 0; i < ih; i++) {
          int line = i;
          if (interlace) {
            if (iline >= ih) {
              pass++;
              switch (pass) {
              case 2:
                iline = 4;
                break;
              case 3:
                iline = 2;
                inc = 4;
                break;
              case 4:
                iline = 1;
                inc = 2;
            line = iline;
            iline += inc;
          line += iy;
          if (line < height) {
            int k = line * width;
            int dx = k + ix; // start of line in dest
            int dlim = dx + iw; // end of dest line
            if ((k + width) < dlim) {
              dlim = k + width; // past dest edge
            int sx = i * iw; // start of line in source
            while (dx < dlim) {
              // map color and insert in destination
              int index = ((int) pixels[sx++]) & 0xff;
              int c = act[index];
              if (c != 0) {
                dest[dx] = c;
              dx++;
       * Gets the image contents of frame n.
       * @return BufferedImage representation of frame, or null if n is invalid.
      public BufferedImage getFrame(int n) {
        BufferedImage im = null;
        if ((n >= 0) && (n < frameCount)) {
          im = ((GifFrame) frames.get(n)).image;
        return im;
       * Gets image size.
       * @return GIF image dimensions
      public Dimension getFrameSize() {
        return new Dimension(width, height);
       * Reads GIF image from stream
       * @param BufferedInputStream
       *          containing GIF file.
       * @return read status code (0 = no errors)
      public int read(BufferedInputStream is) {
        init();
        if (is != null) {
          in = is;
          readHeader();
          if (!err()) {
            readContents();
            if (frameCount < 0) {
              status = STATUS_FORMAT_ERROR;
        } else {
          status = STATUS_OPEN_ERROR;
        try {
          is.close();
        } catch (IOException e) {
        return status;
       * Reads GIF image from stream
       * @param InputStream
       *          containing GIF file.
       * @return read status code (0 = no errors)
      public int read(InputStream is) {
        init();
        if (is != null) {
          if (!(is instanceof BufferedInputStream))
            is = new BufferedInputStream(is);
          in = (BufferedInputStream) is;
          readHeader();
          if (!err()) {
            readContents();
            if (frameCount < 0) {
              status = STATUS_FORMAT_ERROR;
        } else {
          status = STATUS_OPEN_ERROR;
        try {
          is.close();
        } catch (IOException e) {
        return status;
       * Reads GIF file from specified file/URL source (URL assumed if name contains
       * ":/" or "file:")
       * @param name
       *          String containing source
       * @return read status code (0 = no errors)
      public int read(String name) {
        status = STATUS_OK;
        try {
          name = name.trim().toLowerCase();
          if ((name.indexOf("file:") >= 0) || (name.indexOf(":/") > 0)) {
            URL url = new URL(name);
            in = new BufferedInputStream(url.openStream());
          } else {
            in = new BufferedInputStream(new FileInputStream(name));
          status = read(in);
        } catch (IOException e) {
          status = STATUS_OPEN_ERROR;
        return status;
       * Decodes LZW image data into pixel array. Adapted from John Cristy's
       * ImageMagick.
      protected void decodeImageData() {
        int NullCode = -1;
        int npix = iw * ih;
        int available, clear, code_mask, code_size, end_of_information, in_code, old_code, bits, code, count, i, datum, data_size, first, top, bi, pi;
        if ((pixels == null) || (pixels.length < npix)) {
          pixels = new byte[npix]; // allocate new pixel array
        if (prefix == null)
          prefix = new short[MaxStackSize];
        if (suffix == null)
          suffix = new byte[MaxStackSize];
        if (pixelStack == null)
          pixelStack = new byte[MaxStackSize + 1];
        // Initialize GIF data stream decoder.
        data_size = read();
        clear = 1 << data_size;
        end_of_information = clear + 1;
        available = clear + 2;
        old_code = NullCode;
        code_size = data_size + 1;
        code_mask = (1 << code_size) - 1;
        for (code = 0; code < clear; code++) {
          prefix[code] = 0;
          suffix[code] = (byte) code;
        // Decode GIF pixel stream.
        datum = bits = count = first = top = pi = bi = 0;
        for (i = 0; i < npix;) {
          if (top == 0) {
            if (bits < code_size) {
              // Load bytes until there are enough bits for a code.
              if (count == 0) {
                // Read a new data block.
                count = readBlock();
                if (count <= 0)
                  break;
                bi = 0;
              datum += (((int) block[bi]) & 0xff) << bits;
              bits += 8;
              bi++;
              count--;
              continue;
            // Get the next code.
            code = datum & code_mask;
            datum >>= code_size;
            bits -= code_size;
            // Interpret the code
            if ((code > available) || (code == end_of_information))
              break;
            if (code == clear) {
              // Reset decoder.
              code_size = data_size + 1;
              code_mask = (1 << code_size) - 1;
              available = clear + 2;
              old_code = NullCode;
              continue;
            if (old_code == NullCode) {
              pixelStack[top++] = suffix[code];
              old_code = code;
              first = code;
              continue;
            in_code = code;
            if (code == available) {
              pixelStack[top++] = (byte) first;
              code = old_code;
            while (code > clear) {
              pixelStack[top++] = suffix[code];
              code = prefix[code];
            first = ((int) suffix[code]) & 0xff;
            // Add a new string to the string table,
            if (available >= MaxStackSize)
              break;
            pixelStack[top++] = (byte) first;
            prefix[available] = (short) old_code;
            suffix[available] = (byte) first;
            available++;
            if (((available & code_mask) == 0) && (available < MaxStackSize)) {
              code_size++;
              code_mask += available;
            old_code = in_code;
          // Pop a pixel off the pixel stack.
          top--;
          pixels[pi++] = pixelStack[top];
          i++;
        for (i = pi; i < npix; i++) {
          pixels[i] = 0; // clear missing pixels
       * Returns true if an error was encountered during reading/decoding
      protected boolean err() {
        return status != STATUS_OK;
       * Initializes or re-initializes reader
      protected void init() {
        status = STATUS_OK;
        frameCount = 0;
        frames = new ArrayList();
        gct = null;
        lct = null;
       * Reads a single byte from the input stream.
      protected int read() {
        int curByte = 0;
        try {
          curByte = in.read();
        } catch (IOException e) {
          status = STATUS_FORMAT_ERROR;
        return curByte;
       * Reads next variable length block from input.
       * @return number of bytes stored in "buffer"
      protected int readBlock() {
        blockSize = read();
        int n = 0;
        if (blockSize > 0) {
          try {
            int count = 0;
            while (n < blockSize) {
              count = in.read(block, n, blockSize - n);
              if (count == -1)
                break;
              n += count;
          } catch (IOException e) {
          if (n < blockSize) {
            status = STATUS_FORMAT_ERROR;
        return n;
       * Reads color table as 256 RGB integer values
       * @param ncolors
       *          int number of colors to read
       * @return int array containing 256 colors (packed ARGB with full alpha)
      protected int[] readColorTable(int ncolors) {
        int nbytes = 3 * ncolors;
        int[] tab = null;
        byte[] c = new byte[nbytes];
        int n = 0;
        try {
          n = in.read(c);
        } catch (IOException e) {
        if (n < nbytes) {
          status = STATUS_FORMAT_ERROR;
        } else {
          tab = new int[256]; // max size to avoid bounds checks
          int i = 0;
          int j = 0;
          while (i < ncolors) {
            int r = ((int) c[j++]) & 0xff;
            int g = ((int) c[j++]) & 0xff;
            int b = ((int) c[j++]) & 0xff;
            tab[i++] = 0xff000000 | (r << 16) | (g << 8) | b;
        return tab;
       * Main file parser. Reads GIF content blocks.
      protected void readContents() {
        // read GIF file content blocks
        boolean done = false;
        while (!(done || err())) {
          int code = read();
          switch (code) {
          case 0x2C: // image separator
            readImage();
            break;
          case 0x21: // extension
            code = read();
            switch (code) {
            case 0xf9: // graphics control extension
              readGraphicControlExt();
              break;
            case 0xff: // application extension
              readBlock();
              String app = "";
              for (int i = 0; i < 11; i++) {
                app += (char) block;
    if (app.equals("NETSCAPE2.0")) {
    readNetscapeExt();
    } else
    skip(); // don't care
    break;
    default: // uninteresting extension
    skip();
    break;
    case 0x3b: // terminator
    done = true;
    break;
    case 0x00: // bad byte, but keep going and see what happens
    break;
    default:
    status = STATUS_FORMAT_ERROR;
    * Reads Graphics Control Extension values
    protected void readGraphicControlExt() {
    read(); // block size
    int packed = read(); // packed fields
    dispose = (packed & 0x1c) >> 2; // disposal method
    if (dispose == 0) {
    dispose = 1; // elect to keep old image if discretionary
    transparency = (packed & 1) != 0;
    delay = readShort() * 10; // delay in milliseconds
    transIndex = read(); // transparent color index
    read(); // block terminator
    * Reads GIF file header information.
    protected void readHeader() {
    String id = "";
    for (int i = 0; i < 6; i++) {
    id += (char) read();
    if (!id.startsWith("GIF")) {
    status = STATUS_FORMAT_ERROR;
    return;
    readLSD();
    if (gctFlag && !err()) {
    gct = readColorTable(gctSize);
    bgColor = gct[bgIndex];
    * Reads next frame image
    protected void readImage() {
    ix = readShort(); // (sub)image position & size
    iy = readShort();
    iw = readShort();
    ih = readShort();
    int packed = read();
    lctFlag = (packed & 0x80) != 0; // 1 - local color table flag
    interlace = (packed & 0x40) != 0; // 2 - interlace flag
    // 3 - sort flag
    // 4-5 - reserved
    lctSize = 2 << (packed & 7); // 6-8 - local color table size
    if (lctFlag) {
    lct = readColorTable(lctSize); // read table
    act = lct; // make local table active
    } else {
    act = gct; // make global table active
    if (bgIndex == transIndex)
    bgColor = 0;
    int save = 0;
    if (transparency) {
    save = act[transIndex];
    act[transIndex] = 0; // set transparent color if specified
    if (act == null) {
    status = STATUS_FORMAT_ERROR; // no color table defined
    if (err())
    return;
    decodeImageData(); // decode pixel data
    skip();
    if (err())
    return;
    frameCount++;
    // create new image to receive frame data
    image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB_PRE);
    setPixels(); // transfer pixel data to image
    frames.add(new GifFrame(image, delay)); // add image to frame list
    if (transparency) {
    act[transIndex] = save;
    resetFrame();
    * Reads Logical Screen Descriptor
    protected void readLSD() {
    // logical screen size
    width = readShort();
    height = readShort();
    // packed fields
    int packed = read();
    gctFlag = (packed & 0x80) != 0; // 1 : global color table flag
    // 2-4 : color resolution
    // 5 : gct sort flag
    gctSize = 2 << (packed & 7); // 6-8 : gct size
    bgIndex = read(); // background color index
    pixelAspect = read(); // pixel aspect ratio
    * Reads Netscape extenstion to obtain iteration count
    protected void readNetscapeExt() {
    do {
    readBlock();
    if (block[0] == 1) {
    // loop count sub-block
    int b1 = ((int) block[1]) & 0xff;
    int b2 = ((int) block[2]) & 0xff;
    loopCount = (b2 << 8) | b1;
    } while ((blockSize > 0) && !err());
    * Reads next 16-bit value, LSB first
    protected int readShort() {
    // read 16-bit value, LSB first
    return read() | (read() << 8);
    * Resets frame state for reading next image.
    protected void resetFrame() {
    lastDispose = dispose;
    lastRect = new Rectangle(ix, iy, iw, ih);
    lastImage = image;
    lastBgColor = bgColor;
    int dispose = 0;
    boolean transparency = false;
    int delay = 0;
    lct = null;
    * Skips variable length blocks up to and including next zero length block.
    protected void skip() {
    do {
    readBlock();
    } while ((blockSize > 0) && !err());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     

    Niklas wrote:
    This works on WinXP but not Linux. Why? Please don't just post reams of code without providing more context and information.
    How is it failing on Linux? Wrong results? What are they? Error messages? What do they say? You need to give us some place to start looking.

Maybe you are looking for

  • How do I Download from Itunes store using the Apple Lossless format?

    I use my music on a home sterio and import locally from CD's to Windows using the Apple Lossless format only, to achieve the Highest quality sound. However, When I buy from Itunes store I can only get AAC format, which is low quality. How can I get I

  • How do I add third party plug-in to Acrobat Pro XI and add things to the main menu bar.

    Running Acrobat Pro XI, (CC suite) on MacPro OSX 10.8 Main Menu Bar only shows  'Acrobat    File    Edit    View   Window   Help'. No Third Party Plug-ins are shown under 'Acrobat' on the Menu Bar Acrobat Pro 9 (also installed)  shows the Third Party

  • Installing new patch cluster after os is hardened with Jass 4.2

    hi, i have a Solaris 10 system that's hardened with Jass 4.2. what is the correct way/best practice to apply the latest recommended patch cluster? will applying the latest recommended patch cluster 'un harden' the system? thanks.

  • Text From 150 about bill- Not an EE customer

    This morning I recieved a text from 150 saying 'We recently tried to contact you regarding your bill. To avoid interuption of your outbound service please make payment by calling 360 from your handset.' However, I am not an ee customer! I used to be,

  • Prototype constructor in javascript

    What is the need or use of prototype in java script constructors? what is the difference between the following two code samples? /// 1 /////////////// function cat(name) {      this.name = name;      this.talk = function() {           alert( this.nam