A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: speedy gifs with(out) tansparent area

  1. #1
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666

    speedy gifs with(out) tansparent area

    this has been started in another thread but i thought it may be good to put it into an own one:
    gifs with transparent area act faster if you save them without transparent area,then import them to flash,break them apart,cut off the "to be transparent" area and then reduce the vector corner points the shape is made up of as much as possible


    here´s the sample file:
    http://www.stimunation.com/majortom/flas/vektor.zip
    (the sample file was on a german flash cd)
    you can click on the icons on the topright to see the vector/transparent gif comparison and on the left there´s the millisecond timer,the version with vector method is about 100% faster.
    raster graphics don´t look as crisp as before once you break them apart,so this is probably best used for small graphics or moving objects (like particles,rain,bullets etc.).

  2. #2
    Heli Attack! iopred's Avatar
    Join Date
    Jun 2003
    Location
    Sydney, Australia
    Posts
    923
    Thats so wrong.. Simply because I used to do this before I realised gif's kept their transparency (hey, this was Flash 3 days).

    I guess if you make the shape of the vector pixel perfect, it will incur alot of slowdown tho, instead of a rough vector like they have on the demo.
    Christopher Rhodes
    squarecircleco.

  3. #3
    Senior Member Dusarn's Avatar
    Join Date
    Mar 2003
    Location
    TX
    Posts
    157
    That is really cool and kind of unexpected. I'm trying to figure out why that would be faster so I'm going to give my theory, if nothing else just to get it straight in my head.

    I tried running that with just a unfilled circle and it actually ran slower than the broken apart image of that guys head. So here we go:

    Vector images:
    Vector images are a set of calculations that when calculated give the image that you have drawn. Its slower because flash has to do the calculations and then draw the pixels onto the screen.

    Raster Images:
    Raster image files are just stored as pixel data, so flash doesn't have to do any calculations. It just plots the pixels on the screen.

    The broken apart image:
    Going by the test above I did with the unfilled vector circle I'm guessing flash does not store the broken apart image as a vector. It looks like it just stores it in the same format as a raster image.

    I guess since the transparent pixels in the image file are still actually pixel data, flash is still giving them as much attention as a nontransparent pixel. But breaking apart the image and cutting the transparent pixels out means flash no longer has to give any processor time to them.

    It's kind of interesting, I always just thought flash would pass over the transparent pixels faster than the nontransparent ones. It's a good thing to know but I don't think I'll be doing it to all my images (mainly because I don't have the patience ) But ya like you said it's really good for bullets and other small things.

    [Edit]
    Ok I understand what you guys are talking about now. I had never used the 'break apart' option before since I never really saw any real use for it, but I see what it is doing now. It just creates a vector in the shape of the image and just applys a bitmap fill to it. Learn something new everyday.
    Last edited by Dusarn; 03-12-2004 at 03:51 AM.

  4. #4
    Optimist Prime StenFLASH's Avatar
    Join Date
    Mar 2004
    Location
    Canberra, Australia
    Posts
    252
    Originally posted by iopred
    I guess if you make the shape of the vector pixel perfect, it will incur alot of slowdown tho, instead of a rough vector like they have on the demo.
    I was interested to see if that would be the case so I tested it out. I took the steps tomsamson specified and then made the wand tool pixel specific. The head on the right now is my imported and modified pixel perfect one. Runs at approx 2ms slower from what I can tell. Perhaps with a much larger and detailed image it would have a big hit to performance. To that end, I think i'll test that aswell.
    Attached Files Attached Files
    Last edited by StenFLASH; 03-11-2004 at 10:27 PM.

  5. #5
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    Originally posted by iopred
    Thats so wrong.. Simply because I used to do this before I realised gif's kept their transparency (hey, this was Flash 3 days).
    the idea is that you save the gif without transparency and then cut away the area which should be transparent after breaking it apart inside flash.

    Originally posted by iopred

    I guess if you make the shape of the vector pixel perfect, it will incur alot of slowdown tho, instead of a rough vector like they have on the demo.
    the speed difference between vector shape with breaken apart raster (without transparency) fill and the raster with transparency isn´t as big as in the original demo the more corner points your shape is made up of,so its wise to use as few as possible to make the speed impact bigger

  6. #6
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    The example from StenFLASH is surprising. Not much difference between two really, so the reducing corner points doesnt give as much speed as breaking the image up.

  7. #7
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    ok,tested again in my coffee break,for seing an extreme comparison,i imported the gif without transparency,broke it apart, and then used it as fill for a rectangle (->only four corner points),here´s the comparison:

    high quality:
    4 corner points: 24ms
    exact cut out: 30 ms
    gif with transparency: 64 ms


    low quality:
    4 corner points: 16ms
    exact cut out: 19 ms
    gif with transparency: 35 ms


    the more objcts you have,the bigger the impact
    Last edited by tomsamson; 03-12-2004 at 10:54 AM.

  8. #8
    Senior Member Penleeki's Avatar
    Join Date
    Mar 2003
    Location
    England
    Posts
    223
    Didn't someone post something a while back like rough speed comparison between the number of pixels, and the number of curves in a vector image?
    Something along the lines of 40ish pixels is about 1 curve?
    Maybe I imagined it..
    Last edited by Penleeki; 03-13-2004 at 10:13 AM.

  9. #9
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    don´t remember seing that,would be interesting though

  10. #10
    Member
    Join Date
    Aug 2004
    Location
    Bradford
    Posts
    31
    I don't know if this is helpful, but when I want a smoother transparent gif or whatever I use 'Trace Bitmap' and just covert each pixel into a shape. This works well for stuff like old game graphics if you're going for a 'retro' look in your flash.
    Jeez, if THAT'S the way God made you,
    God's a real jerk...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center