Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
Tweening of 2 Coloured Images: Now Saving Animated Gif (Yay)
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Error installing EyeCandy...
by
madref
[
Today
at 12:46:05 am]
Lazarus undead repository...
by
CM630
[August 11, 2026, 11:40:09 pm]
LRS Explorer
by
CM630
[August 11, 2026, 11:33:24 pm]
Identify network devices
by
Warfley
[August 11, 2026, 10:55:13 pm]
The best name for procedu...
by
J-G
[August 11, 2026, 07:49:19 pm]
var vs out
by
Paolo
[August 11, 2026, 06:37:35 pm]
[UNSOLVED] Splitting an i...
by
madref
[August 11, 2026, 05:40:09 pm]
Lazarus Bugfix Release 4....
by
geraldholdsworth
[August 11, 2026, 04:55:42 pm]
[Solved[ How to define th...
by
Mike.Cornflake
[August 11, 2026, 03:42:11 pm]
Dataset EnableControls/Di...
by
Mike.Cornflake
[August 11, 2026, 03:37:42 pm]
'ReadStr' ?
by
J-G
[August 11, 2026, 03:07:16 pm]
Debugging in a real termi...
by
Martin_fr
[August 11, 2026, 02:59:09 pm]
how to bring in view the ...
by
Aruna
[August 11, 2026, 02:33:55 pm]
Is it possible to communi...
by
dbannon
[August 11, 2026, 02:15:44 pm]
TFPHTTPServer DDoS protec...
by
LemonParty
[August 11, 2026, 12:54:23 pm]
enable easy marker moveme...
by
Paolo
[August 11, 2026, 12:10:00 pm]
Unleashed Pascal (async/a...
by
creaothceann
[August 11, 2026, 12:09:09 pm]
MOVED: soucis scrollbars ...
by
Martin_fr
[August 11, 2026, 11:09:38 am]
soucis scrollbars V4.8 ?
by
Martin_fr
[August 11, 2026, 11:08:13 am]
Star Wars Galaxian
by
PierceNg
[August 11, 2026, 10:37:08 am]
[closed] Is case for stri...
by
egsuh
[August 11, 2026, 10:27:17 am]
Automatic generation of *...
by
dbannon
[August 11, 2026, 09:00:50 am]
Gtk3 becomes default widg...
by
dbannon
[August 11, 2026, 08:44:10 am]
TurboBird for FireBird 5
by
laguna
[August 11, 2026, 07:45:04 am]
Bugs caused by the weathe...
by
dsiders
[August 11, 2026, 04:40:59 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Tweening of 2 Coloured Images: Now Saving Animated Gif (Yay) (Read 1724 times)
Boleeman
Hero Member
Posts: 1166
Tweening of 2 Coloured Images: Now Saving Animated Gif (Yay)
«
on:
September 01, 2024, 08:44:18 am »
Converted some Delphi code and
added Endless Play back animation features
.
Loads only bmp and needs to be 24bit and same sized.
Transparent pngs would be nice and make it so it can load other formats and make images same sized if loaded with different sizes.
Also
would like an export to animated gif or avi.
Might need to be convert from TImage to bgrabmp.
Just added a save the displayed tween frame to png.
«
Last Edit: September 03, 2024, 01:04:27 pm by Boleeman
»
Logged
Now Prototyping in OpenProcessing and P5js
https://openprocessing.org/@Boleeman#sketches
https://editor.p5js.org/Boleeman/sketches
paweld
Hero Member
Posts: 1691
Re: Tweening of 2 Coloured Images: extra features needed.
«
Reply #1 on:
September 01, 2024, 11:01:09 am »
Added BGRABitmap support:
- support formats: bmp, png, jpg, gif
- support for transparency
- auto resizing second image
Edited few minutes later: removed memory leaks
«
Last Edit: September 01, 2024, 11:16:12 am by paweld
»
Logged
Best regards / Pozdrawiam
paweld
Boleeman
Hero Member
Posts: 1166
Re: Tweening of 2 Coloured Images: extra features needed.
«
Reply #2 on:
September 01, 2024, 11:36:51 am »
Thanks for helping out Paweld.
Ah I see you did some fixes.
Was getting these errors.
List out of bounds.
Also not Tweening midway on some occassions.
Also Reset not working.
I will test your new update.
I appreciate your help. Thanks.
What I noticed after testing your fix:
After loading the images and moving the trackbar I get the Tweening happening.
If I click Create Sequence and then click either
Show Tween
or
Show Seq Fwd Back Buttons
the the tweening stops working until the very end.
If I then click Reset and move the trackbar I get the Tweening happening again, but then I get a List Index (0) out of bounds error when I click either
Show Tween
or
Show Seq Fwd Back Buttons
.
«
Last Edit: September 01, 2024, 11:58:00 am by Boleeman
»
Logged
Now Prototyping in OpenProcessing and P5js
https://openprocessing.org/@Boleeman#sketches
https://editor.p5js.org/Boleeman/sketches
paweld
Hero Member
Posts: 1691
Re: Tweening of 2 Coloured Images: extra features needed.
«
Reply #3 on:
September 01, 2024, 12:16:22 pm »
fixed
Logged
Best regards / Pozdrawiam
paweld
Boleeman
Hero Member
Posts: 1166
Re: Tweening of 2 Coloured Images: extra features needed.
«
Reply #4 on:
September 01, 2024, 12:31:50 pm »
Wow Paweld that last update works well.
I tried fixing the errors but was going round in circles.
Like how you made the frame number for the saved png.
That is a good feature for saving to an animation.
Paweld, I also tested two transparent pngs of 2 different sizes.
The saved png was also saved transparently.
Worked well. Success. Hooray !
Thanks Paweld for those great additions.
«
Last Edit: September 01, 2024, 12:53:33 pm by Boleeman
»
Logged
Now Prototyping in OpenProcessing and P5js
https://openprocessing.org/@Boleeman#sketches
https://editor.p5js.org/Boleeman/sketches
Boleeman
Hero Member
Posts: 1166
Re: Tweening of 2 Coloured Images: Extra features added by Paweld. Thanks.
«
Reply #5 on:
September 01, 2024, 01:06:33 pm »
Sorry to bother again.
Was getting a Heap trace message after ending the program.
Also the release version file size seems unusually large. Not sure why?
Logged
Now Prototyping in OpenProcessing and P5js
https://openprocessing.org/@Boleeman#sketches
https://editor.p5js.org/Boleeman/sketches
paweld
Hero Member
Posts: 1691
Re: Tweening of 2 Coloured Images: Extra features added by Paweld. Thanks.
«
Reply #6 on:
September 01, 2024, 01:11:46 pm »
Menu:
Project > Project options
, on options tree
Compiler options > Debugging
uncheck
Use Heaptrc unit
and
Trash variables
. I enabled this options to check mem leaks.
Logged
Best regards / Pozdrawiam
paweld
Boleeman
Hero Member
Posts: 1166
Re: Tweening of 2 Coloured Images: Extra features added by Paweld. Thanks.
«
Reply #7 on:
September 02, 2024, 09:35:28 am »
Paweld, Yes that was it. Turn of Heap Trc and Trash Variable. Release exe file back to normal size and message gone.
Thanks for your great help on this Tween program. Much appreciated Paweld.
Logged
Now Prototyping in OpenProcessing and P5js
https://openprocessing.org/@Boleeman#sketches
https://editor.p5js.org/Boleeman/sketches
Boleeman
Hero Member
Posts: 1166
Re: Tweening of 2 Coloured Images: Extra features added by Paweld. Thanks.
«
Reply #8 on:
September 02, 2024, 10:10:44 am »
I tried saving to animated gif with this code but I get an access violation:
Code: Pascal
[Select]
[+]
[-]
procedure
TFormTween
.
btbMakeAnigifClick
(
Sender
:
TObject
)
;
var
GifImage
:
TBGRAAnimatedGif
;
i
:
Integer
;
Speed
:
Integer
;
bmp
:
TBGRABitmap
;
ResizedBmp
:
TBGRABitmap
;
png
:
TPortableNetworkGraphic
;
ms
:
TMemoryStream
;
begin
Speed
:
=
SpinEditDelay
.
Value
;
GifImage
:
=
TBGRAAnimatedGif
.
Create
;
try
GifImage
.
SetSize
(
ImageTween
.
Width
,
ImageTween
.
Height
)
;
GifImage
.
LoopCount
:
=
0
;
for
i
:
=
0
to
ImageSequence
.
Count
-
1
do
begin
png
:
=
ImageSequence
[
i
]
as TPortableNetworkGraphic
;
bmp
:
=
TBGRABitmap
.
Create
;
try
ms
:
=
TMemoryStream
.
Create
;
try
png
.
SaveToStream
(
ms
)
;
// Save PNG to memory stream
ms
.
Position
:
=
0
;
bmp
.
LoadFromStream
(
ms
)
;
// Load from memory stream to TBGRABitmap
// Resize bitmap if necessary
if
(
bmp
.
Width
<> GifImage
.
Width
)
or
(
bmp
.
Height
<> GifImage
.
Height
)
then
begin
ResizedBmp
:
=
bmp
.
Resample
(
GifImage
.
Width
,
GifImage
.
Height
)
;
try
GifImage
.
AddFullFrame
(
ResizedBmp
,
Speed
)
;
finally
ResizedBmp
.
Free
;
end
;
end
else
begin
GifImage
.
AddFullFrame
(
bmp
,
Speed
)
;
end
;
finally
ms
.
Free
;
end
;
finally
bmp
.
Free
;
end
;
end
;
GifImage
.
OptimizeFrames
;
if
SaveDialog1
.
Execute
then
begin
if
SaveDialog1
.
FileName
<>
''
then
begin
GifImage
.
SaveToFile
(
ChangeFileExt
(
SaveDialog1
.
FileName
,
'.gif'
)
)
;
end
else
begin
ShowMessage
(
'No file name specified.'
)
;
end
;
end
;
finally
GifImage
.
Free
;
end
;
end
;
«
Last Edit: September 02, 2024, 04:16:10 pm by Boleeman
»
Logged
Now Prototyping in OpenProcessing and P5js
https://openprocessing.org/@Boleeman#sketches
https://editor.p5js.org/Boleeman/sketches
circular
Hero Member
Posts: 4471
Re: Tweening of 2 Coloured Images: Save Animated Gif Problems.
«
Reply #9 on:
September 02, 2024, 07:23:56 pm »
Hmm not sure why you would get an error. If you enabled debug info, what is the stack trace?
Logged
Conscience is the debugger of the mind
Boleeman
Hero Member
Posts: 1166
Re: Tweening of 2 Coloured Images: Save Animated Gif Problems.
«
Reply #10 on:
September 03, 2024, 01:03:44 pm »
Circular, Access violation solved: Missing BGRAColorQuantizerFactory := TBGRAColorQuantizer;
Cannot believe it. I remembered from
https://forum.lazarus.freepascal.org/index.php/topic,68394.0.html
that I needed to add it because I was getting a similar Acess Violation error.
The animated gif gets quite large if there are a lot of tween frames.
I made a sample animated gif with only 3 frames (slowed down) due to file size limit of attachments.
Takes a while to render the animated gif. Not sure why. Maybe TBGRAColorQuantizer ?
«
Last Edit: September 03, 2024, 01:11:29 pm by Boleeman
»
Logged
Now Prototyping in OpenProcessing and P5js
https://openprocessing.org/@Boleeman#sketches
https://editor.p5js.org/Boleeman/sketches
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
Tweening of 2 Coloured Images: Now Saving Animated Gif (Yay)
TinyPortal
© 2005-2018