Not quite programming but... Shrink size of animated GIF ?
Not quite programming but... Shrink size of animated GIF ?
I have an animated GIF I`d like to use as an avatar, but it`s 12.55 KB and only 6 KB is allowed.
What package for Puppy can shrink the KB size and maybe it`s pixel dimensions?
I don`t know what the pixel size is ( it`s not very big ), but it`s probably not correct.
Just shrinking it to the allowed 80 x 80 pixels may lower the KB size to under 6 KB.
What package for Puppy can shrink the KB size and maybe it`s pixel dimensions?
I don`t know what the pixel size is ( it`s not very big ), but it`s probably not correct.
Just shrinking it to the allowed 80 x 80 pixels may lower the KB size to under 6 KB.
- AF Branden
- Posts: 165
- Joined: Tue 15 Sep 2009, 10:17
- Location: United States, WA
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
I just added it to my optimizer collection
using
gifsicle --optimize=3 --use-colormap web input_file > output_file
using
gifsicle --optimize=3 --use-colormap web input_file > output_file
- Attachments
-
- gifsicle-1.63-i486.pet
- (91.84 KiB) Downloaded 249 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Thanks technosaurus; I tried the Deb package from the web site and no go...
This is the info I got about the gif file:
I`m no expert, but it looks like there`s not much room for improvement?
The pixel size is good, could be trimmed to 72x72 if needed.
Maybe go to 4 colors? I don`t know what else to do.
I tried your command and it went from 12.5 KB to 9.5 KB, not enough.
Any further suggestions? I`m almost half way there!
This is the info I got about the gif file:
Code: Select all
# gifsicle -I "#0" < /mnt/sdb3/docs/pics/Quake1_Flames.gif
* <stdin> 10 images
logical screen 72x80
global color table [16]
background 0
end comment This GIF file was assembled with GIF Construction Set from:\r\n\r\nAlchemy Mindworks Inc.\r\nP.O. Box 500\r\nBeeton, Ontario\r\nL0G 1A0\r\nCANADA.\r\n\r\nThis comment block will not appear in files created with a registered version of GIF Construction Set
loop forever
extensions 1
+ image #0 72x80
delay 0.01s
The pixel size is good, could be trimmed to 72x72 if needed.
Maybe go to 4 colors? I don`t know what else to do.
I tried your command and it went from 12.5 KB to 9.5 KB, not enough.
Any further suggestions? I`m almost half way there!
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
I remember doing little tricks back in the 90s, like only using the diff for each frame, playing with the palette or even going monochrome (flames could be monochrome red & yellow vs black & white)
Sometimes shifting the image around, can get better results if it starts at a different point... algorithms & such
Sometimes shifting the image around, can get better results if it starts at a different point... algorithms & such
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
not a diff exactly, I guess ... well actuall I guess it is ... a 2 dimensional (3 if you include color)
since the next image in a gif overlays the previous... no need to redraw all of sponge bob if he only moves his leg ... just the background of where his leg used to be and where it is now
... also - stripping the comments may take up to a Kb
gifsicle can do all of this:
since the next image in a gif overlays the previous... no need to redraw all of sponge bob if he only moves his leg ... just the background of where his leg used to be and where it is now
... also - stripping the comments may take up to a Kb
gifsicle can do all of this:
Code: Select all
'Gifsicle' manipulates GIF images. Its most common uses include combining
single images into animations, adding transparency, optimizing animations for
space, and printing information about GIFs.
Usage: gifsicle [OPTION | FILE | FRAME]...
Mode options: at most one, before any filenames.
-m, --merge Merge mode: combine inputs, write stdout.
-b, --batch Batch mode: modify inputs, write back to
same filenames.
-e, --explode Explode mode: write N files for each input,
one per frame, to 'input.frame-number'.
-E, --explode-by-name Explode mode, but write 'input.name'.
General options: Also --no-OPTION for info and verbose.
-I, --info Print info about input GIFs. Two -I's means
normal output is not suppressed.
--color-info, --cinfo --info plus colormap details.
--extension-info, --xinfo --info plus extension details.
-V, --verbose Prints progress information.
-h, --help Print this message and exit.
--version Print version number and exit.
-o, --output FILE Write output to FILE.
-w, --no-warnings Don't report warnings.
--conserve-memory Conserve memory at the expense of speed.
--multifile Support concatenated GIF files.
Frame selections: #num, #num1-num2, #num1-, #name
Frame change options:
--delete FRAMES Delete FRAMES from input.
--insert-before FRAME GIFS Insert GIFS before FRAMES in input.
--append GIFS Append GIFS to input.
--replace FRAMES GIFS Replace FRAMES with GIFS in input.
--done Done with frame changes.
Image options: Also --no-OPTION and --same-OPTION.
-B, --background COL Make COL the background color.
--crop X,Y+WxH, --crop X,Y-X2,Y2
Crop the image.
--crop-transparency Crop transparent borders off the image.
--flip-horizontal, --flip-vertical
Flip the image.
-i, --interlace Turn on interlacing.
-S, --logical-screen WxH Set logical screen to WxH.
-p, --position X,Y Set frame position to (X,Y).
--rotate-90, --rotate-180, --rotate-270, --no-rotate
Rotate the image.
-t, --transparent COL Make COL transparent.
Extension options: Also --no-OPTION and --same-OPTION.
-x, --app-extension N D Add an app extension named N with data D.
-c, --comment TEXT Add a comment before the next frame.
--extension N D Add an extension number N with data D.
-n, --name TEXT Set next frame's name.
Animation options: Also --no-OPTION and --same-OPTION.
-d, --delay TIME Set frame delay to TIME (in 1/100sec).
-D, --disposal METHOD Set frame disposal to METHOD.
-l, --loopcount[=N] Set loop extension to N (default forever).
-O, --optimize[=LEVEL] Optimize output GIFs.
-U, --unoptimize Unoptimize input GIFs.
Whole-GIF options: Also --no-OPTION.
--careful Write larger GIFs that avoid bugs in other
programs.
--change-color COL1 COL2 Change COL1 to COL2 throughout.
-k, --colors N Reduce the number of colors to N.
--color-method METHOD Set method for choosing reduced colors.
-f, --dither Dither image after changing colormap.
--resize WxH Resize the output GIF to WxH.
--resize-width W Resize to width W and proportional height.
--resize-height H Resize to height H and proportional width.
--scale XFACTOR[xYFACTOR] Scale the output GIF by XFACTORxYFACTOR.
--transform-colormap CMD Transform each output colormap by shell CMD.
--use-colormap CMAP Set output GIF's colormap to CMAP, which can
be 'web', 'gray', 'bw', or a GIF file.
Report bugs to <ekohler@gmail.com>.
Too much information? Try 'gifsicle --help | more'.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Not to be a pest, I looked at the help but I don`t see how to do either thing you suggested.
To strip the "end comment" what would I do?
I assume if there were other comments it would show them in the info.
The diff thing sounds like some pixel editing on the 10 GIFs, will mPaint do this?
To strip the "end comment" what would I do?
Code: Select all
end comment This GIF file was assembled with GIF Construction Set from:\r\n\r\nAlchemy Mindworks Inc.\r\nP.O. Box 500\r\nBeeton, Ontario\r\nL0G 1A0\r\nCANADA.\r\n\r\nThis comment block will not appear in files created with a registered version of GIF Construction Set
The diff thing sounds like some pixel editing on the 10 GIFs, will mPaint do this?
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
for whatever reason gifsicle cannot strip the comments, but convert from imagemagick can
the other part is a real PITA on all but the most basic images, I don't know of a program that will just show the differing pixels ... would be a handy too ... it is the way most modern video compression technologies work ... webm does this based on an initial webp image
the other part is a real PITA on all but the most basic images, I don't know of a program that will just show the differing pixels ... would be a handy too ... it is the way most modern video compression technologies work ... webm does this based on an initial webp image
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
I use a script "scale" that works with exactimagetechnosaurus wrote:for whatever reason gifsicle cannot strip the comments, but convert from imagemagick can
the other part is a real PITA on all but the most basic images, I don't know of a program that will just show the differing pixels ... would be a handy too ... it is the way most modern video compression technologies work ... webm does this based on an initial webp image
example: 'scale old.png new.png 16'
Code: Select all
#!/bin/sh
if [ "$1" = "-h" -o "$1" = "" ]; then
echo "example: 'scale old.png new.png 16'"
exit
fi
OldSize=`edentify $1 | cut -d" " -f3| cut -d"x" -f1`
size=`dc $3 $OldSize / p`
econvert -i $1 --scale $size -o $2
Thanks jpeps; It looks like it sizes the gif which gifsicle already did.
To strip the comment would allow it to be sized a little larger, that`d be nice...
To create a diff gif I`m not sure would save space.
If the transparent parts had no color data then maybe it would.
Most of this animated gif is black, so maybe some space could be saved.
To strip the comment would allow it to be sized a little larger, that`d be nice...
To create a diff gif I`m not sure would save space.
If the transparent parts had no color data then maybe it would.
Most of this animated gif is black, so maybe some space could be saved.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
I've been meaning to compile exactimage again.
I wonder if converting the animated gif to Webm and back would automatically do the pixel diff (iirc the pframes are full compressed images, but the iframes are only the parts that are changed ... not sure if my terminology is correct )
I wonder if converting the animated gif to Webm and back would automatically do the pixel diff (iirc the pframes are full compressed images, but the iframes are only the parts that are changed ... not sure if my terminology is correct )
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
I understand what you mean, even if your terminology may not be correct.
Delta encodes the changed parts frame to frame starting from a full key frame.
For my icon changing parts are just the flames which is 1/3 to 1/2 of the icon.
So as I said, if the color info is not there for the static parts then a smaller size.
Don`t know the icon format setup, I`d think a color for each pixel in a grid.
So then it`d be hard to see how a Delta encoding could be applied to it.
However the icon`s format may allow for many other possible methods.
Delta encodes the changed parts frame to frame starting from a full key frame.
For my icon changing parts are just the flames which is 1/3 to 1/2 of the icon.
So as I said, if the color info is not there for the static parts then a smaller size.
Don`t know the icon format setup, I`d think a color for each pixel in a grid.
So then it`d be hard to see how a Delta encoding could be applied to it.
However the icon`s format may allow for many other possible methods.
Hi Sunburnt,
I grabbed you existing gif avatar. Googled a little and played with Imagemagick.
This converts the .gif to seperate .bmp frames. (.bmp doesn't support comments)
This puts the frames back together.
Original: 6119B Converted: 3728B
Removing the comments didn't reduce size that much, but if you were really close
it might be the difference in coming in under the wire.
In a blindfold test, I don't think I could tell the difference between the two gifs.
rod
Also, "identify -verbose filename.gif" will give all sorts of info. Like the timing dalay,
show the comments, number of colors, etc...
I grabbed you existing gif avatar. Googled a little and played with Imagemagick.
This converts the .gif to seperate .bmp frames. (.bmp doesn't support comments)
Code: Select all
convert sunburnt.gif -scene 1 +adjoin frame_%02d.bmp
Code: Select all
convert frame_*.bmp -depth 16 -colors 8 -delay 100 -loop 0 new.gif
Removing the comments didn't reduce size that much, but if you were really close
it might be the difference in coming in under the wire.
In a blindfold test, I don't think I could tell the difference between the two gifs.
rod
Also, "identify -verbose filename.gif" will give all sorts of info. Like the timing dalay,
show the comments, number of colors, etc...
- Attachments
-
- new.gif
- (3.64 KiB) Downloaded 196 times