ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to save animated gif image correctly

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
mhieta Posted - Mar 27 2012 : 02:21:10
Hi,

I'm using ImageEn 4.1.0.

Currently I'm using ImageEnMView component to save gif image what has frames with transparent background. But after saving image with ImageEnMView and loading saved image back to ImageEnMView I can see black stripe in second frame but not in the first frame. I guess that those black stripes are background color. What params do I need to set so I don't get those black stripes?

- Marko
10   L A T E S T    R E P L I E S    (Newest First)
mhieta Posted - Mar 28 2012 : 23:11:12
Hi,

I think I found answer to that black stripe.
If those frames are different sizes then SaveToFile adjusts frame sizes (second frame not first one).
So I see then that black stripe. :) Now I need to make sure that frames are same sizes when saving animated gif.

- Marko
mhieta Posted - Mar 28 2012 : 22:02:44
Hi,

Here is the original image from the Firefox about:home page:



But I used screen shot from that about:home page and converted white color to transparent with Proc.SetTransparentColors. Thats why you see white area in my "This black strip:" post.

Anyway. I don't see black stripe before .MIO.SaveToFile.

- Marko
fab Posted - Mar 28 2012 : 13:31:54
Please send the original file, not the one you have saved with SaveToFile.
mhieta Posted - Mar 28 2012 : 13:07:45
That test_2.gif is result file after MIO.SaveToFile. test_2.gif is build from "scratch" by steps what I described in earlier message.

- Marko
fab Posted - Mar 28 2012 : 12:44:31
Is the file you have post the Original image or is it the resulting file after MIO.SaveToFile?
mhieta Posted - Mar 28 2012 : 07:59:34
Also please note that I stripped few lines of unneeded code. :)

- Marko
mhieta Posted - Mar 28 2012 : 07:57:17
Hi,

Okay here is basically what I do now:

First I add page:

procedure TMDIChild.AddPageClick(Sender: TObject);
var
tempbmp: TBitmap;
idx: integer;
begin
idx := ImageEnMView1.SelectedImage;
if idx < 0 then
idx := 0;
ImageEnMView1.InsertImage(idx);
tempbmp := TBitmap.create;
tempbmp.width := 800;
tempbmp.height := 600;
tempbmp.pixelformat := pf24bit;
ImageEnMView1.SetImage(idx, tempbmp);
tempbmp.free;
for idx := 0 to ImageEnMView1.ImageCount - 1 do
begin
ImageEnMView1.ImageTopText[idx].Caption := 'Image ' + inttostr(idx);
ImageEnMView1.ImageInfoText[idx].Caption := inttostr(ImageEnMView1.ImageWidth[idx]) + ' x ' + inttostr(ImageEnMView1.ImageHeight[idx]);
end;
ImageEnMView1ImageSelect(nil, ImageEnMView1.SelectedImage);
Changed := true;
end;

Then I paste image in to ImageEnView and I update ImageEnMView page:

procedure TMDIChild.UpdatePageClick(Sender: TObject);
var
idx: integer;
begin
idx := ImageEnMView1.SelectedImage;
if idx>-1 then
begin
ImageEnView1.Proc.SaveUndo(ieuImage);
ImageEnMView1.SetIEBitmap(idx, ImageEnView1.IEBitmap);
ImageEnView1.Proc.Undo;
Changed := true;
end;
for idx := 0 to ImageEnMView1.ImageCount - 1 do
begin
ImageEnMView1.ImageTopText[idx].Caption := 'Image ' + inttostr(idx);
ImageEnMView1.ImageInfoText[idx].Caption := inttostr(ImageEnMView1.ImageWidth[idx]) + ' x ' + inttostr(ImageEnMView1.ImageHeight[idx]);
end;
end;

Then I can select page like this:

procedure TMDIChild.ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
var
Posit: Integer;
FileName3: String;
begin
ImageEnView1.IEBitmap.Assign(ImageEnMView1.GetTIEBitmap(idx));
ImageEnView1.Refresh;
end;

Then I save ImageEnMView gif file:

if (Ext = '.gif') then
begin
SaveImageEnDialog1.FilterIndex:=2;
end;
if SaveImageEnDialog1.Execute then
begin
(ActiveMDIChild as TMDIChild).Caption := SaveImageEnDialog1.FileName;
(ActiveMDIChild as TMDIChild).ImageEnMView1.MIO.SaveToFile((ActiveMDIChild as TMDIChild).Caption);
end;

Then I open gif image in to ImageEnMView:

if IEGetFileFramesCount(Name) > 1 then
begin
Child.ImageEnMView1.Clear;
Child.ImageEnMView1.LockPaint;
Child.ImageEnMView1.MIO.LoadFromFileAuto(Name);
for idx := 0 to Child.ImageEnMView1.ImageCount - 1 do
begin
Child.ImageEnMView1.ImageTopText[idx].Caption := 'Image ' + inttostr(idx);
Child.ImageEnMView1.ImageInfoText[idx].Caption := inttostr(Child.ImageEnMView1.ImageWidth[idx]) + ' x ' + inttostr(Child.ImageEnMView1.ImageHeight[idx]);
end;
Child.ImageEnMView1.UnLockPaint;
end;



- Marko
fab Posted - Mar 27 2012 : 13:47:37
Please could post the original GIF and the code you used?
mhieta Posted - Mar 27 2012 : 07:25:30
Hi,

This black strip:



- Marko
xequte Posted - Mar 27 2012 : 02:45:59
Hi Marko

Can you please attach a screen shot of what you are seeing.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com