Re: The Shrinking size of animated gif

2017-10-31 Thread Richmond Mathewson via use-livecode

I'll "have a bash at this" tonight: currently in my lunch break.

HOWEVER . . .

I ALWAYS decompose an animated GIF into constituent frames (which I then 
export on PNG format)

using GIMP . . .

OK, it's long and tedious, but at least I have a considerable amount of 
control over the process.


Richmond.

On 10/31/17 4:54 am, Alejandro Tejada via use-livecode wrote:

Hi All,

Could you verify if always that we convert
an animaated gif in a series of png images
the resulting images are always smaller
than the original animated gif?

Here is the recipe:

1) Create a new stack

2) create a button and paste this script
into the button: (check for broken lines
in the mail list server)


on mouseUp

-- first, delete all previous images
repeat with i = the number of controls of this card down to 1
   if word 1 of the long  name of control i of this card is "image" then
delete control i of this card
end repeat

answer file "Choose an animated gif..."
import paint from file it
try
   put the framecount of img 1 into k
   repeat with m = 1 to k
  set the currentframe of img 1 to m
  create image
  set the width of it to the width of img 1
  set the height of it to the height of img 1
  set the imagedata of it to the imagedata of img 1
  set the alphadata of it to the alphadata of img 1
   end repeat

   repeat with i = 1 to the number of controls of this card
  put the long name of control i of this card into q
  if word 1 of q is "image" then
 put the size of q & comma after n
  end if
   end repeat

   delete last char of n -- a comma
   put item 1 of n into tAnimatedGifSize
   delete item 1 of n
   put sum(n) into tPngImagesSize

   if tAnimatedGifSize > tPngImagesSize then
  put "Animated gif is " & (tAnimatedGifSize - tPngImagesSize) & "
bytes larger than png images"
   else
  -- sum of sizes of png images is larger
  -- than size of animated gif
  put "Png images are " & (tPngImagesSize - tAnimatedGifSize) & "
bytes larger than animated gif"
   end if
end try
end mouseUp



3) Click the button and import an animated gif

Post your results in this thread,
Thanks a lot in advance!

Al
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: The Shrinking size of animated gif

2017-10-30 Thread Roger Guay via use-livecode
I get "Png images are 130036bytes larger than animated gif”

HTH,

Roger

> On Oct 30, 2017, at 7:54 PM, Alejandro Tejada via use-livecode 
>  wrote:
> 
> Could you verify if always that we convert
> an animaated gif in a series of png images
> the resulting images are always smaller
> than the original animated gif?

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

The Shrinking size of animated gif

2017-10-30 Thread Alejandro Tejada via use-livecode
Hi All,

Could you verify if always that we convert
an animaated gif in a series of png images
the resulting images are always smaller
than the original animated gif?

Here is the recipe:

1) Create a new stack

2) create a button and paste this script
into the button: (check for broken lines
in the mail list server)


on mouseUp

-- first, delete all previous images
   repeat with i = the number of controls of this card down to 1
  if word 1 of the long  name of control i of this card is "image" then
delete control i of this card
   end repeat

   answer file "Choose an animated gif..."
   import paint from file it
   try
  put the framecount of img 1 into k
  repeat with m = 1 to k
 set the currentframe of img 1 to m
 create image
 set the width of it to the width of img 1
 set the height of it to the height of img 1
 set the imagedata of it to the imagedata of img 1
 set the alphadata of it to the alphadata of img 1
  end repeat

  repeat with i = 1 to the number of controls of this card
 put the long name of control i of this card into q
 if word 1 of q is "image" then
put the size of q & comma after n
 end if
  end repeat

  delete last char of n -- a comma
  put item 1 of n into tAnimatedGifSize
  delete item 1 of n
  put sum(n) into tPngImagesSize

  if tAnimatedGifSize > tPngImagesSize then
 put "Animated gif is " & (tAnimatedGifSize - tPngImagesSize) & "
bytes larger than png images"
  else
 -- sum of sizes of png images is larger
 -- than size of animated gif
 put "Png images are " & (tPngImagesSize - tAnimatedGifSize) & "
bytes larger than animated gif"
  end if
   end try
end mouseUp



3) Click the button and import an animated gif

Post your results in this thread,
Thanks a lot in advance!

Al
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode