Exporting images from ZGE
Moderator: Moderators
Exporting images from ZGE
Hi,
I'd like to make some animated gif from rotating models in ZGE.
Is it possible to export some frames to png or another image format?
Or do I have to use an external recording software?
Thanks!
I'd like to make some animated gif from rotating models in ZGE.
Is it possible to export some frames to png or another image format?
Or do I have to use an external recording software?
Thanks!
Re: Exporting images from ZGE
Hi Ats,
![Image](http://i.imgur.com/2pVnAJs.gif)
K
If you want to do a clean & consistent rotating GIF it's best to capture the frames from ZGE itself.Ats wrote:I'd like to make some animated gif from rotating models in ZGE.
Such feature is not built-in, but it's pretty easy to do by yourself .. attached is a example ( press F to save a frame ) and below is the generated GIF ( from the captured frames ).Ats wrote:Is it possible to export some frames to png or another image format?
![Image](http://i.imgur.com/2pVnAJs.gif)
K
- Attachments
-
- Capture.zgeproj
- (3.64 KiB) Downloaded 889 times
Hi Ats,
By the way, the fighter and interceptor GIFs contain duplicate frames ( the first frame is identical to the last one ) which causes the "hiccup" after each rotation.
And personally i would have gone with flat shading, but that's just a artistic choice![Wink :wink:](./images/smilies/icon_wink.gif)
K
How long does it take to capture a frame on your computer? I get about 15 TGAs per second when i set the KeyPress.RepeatDelay of the Capture example to 0.Ats wrote:I didn't think that it would take that much time for the processor to make a capture
By the way, the fighter and interceptor GIFs contain duplicate frames ( the first frame is identical to the last one ) which causes the "hiccup" after each rotation.
And personally i would have gone with flat shading, but that's just a artistic choice
![Wink :wink:](./images/smilies/icon_wink.gif)
K
mmm... Even with the KeyPress.RepeatDelay set to 0, it takes almost 3 seconds per frame on your ZGE project to make a capture...
I'm using an Asus Transformer T100 (http://www.engadget.com/products/asus/t ... 100/specs/).
For the flat shading, you are totally right. I'm working on this game from time to time for so long that I don't even remember why I went with smooth shading... I'll make new gif this afternoon![Smile :)](./images/smilies/icon_smile.gif)
Edit: Oh yeah, now I'm remember, that was for the asteroïds. So I'm keeping smooth material only for them.
I'm using an Asus Transformer T100 (http://www.engadget.com/products/asus/t ... 100/specs/).
For the flat shading, you are totally right. I'm working on this game from time to time for so long that I don't even remember why I went with smooth shading... I'll make new gif this afternoon
![Smile :)](./images/smilies/icon_smile.gif)
Edit: Oh yeah, now I'm remember, that was for the asteroïds. So I'm keeping smooth material only for them.
Hi Ats,
Just tried it on a 10 year old laptop ( with Intel GPU ) and still get 7 frames per second ( held the F key down for a minute and got 422 TGAs ). Are you running anti-virus software or something?
K
That's outrageously slowAts wrote:Even with the KeyPress.RepeatDelay set to 0, it takes almost 3 seconds per frame on your ZGE project to make a capture.
![Confused :?](./images/smilies/icon_confused.gif)
K
Re: Exporting images from ZGE
I'm back at taking screenshots.
So I'm digging through Capture.zgeproj and I have some questions:
How do we know that the exported image is a tga, other than by setting that in the file name?
Could that be a friendlier format, like bmp or png?
Is there a size limit for FrameBuffer.SizeDim1? Could 1280x1024 fit in that?
Edit: Seems like it does. The problem was coming from my next problem:
Not every exported images are readable. And sometimes the file size can vary (a lot) from one image to another, even if I deactivate the diamond rotation so the images are exactly the same.
Edit: Seems that last one is Dropbox's fault. Since I'm working inside the synchronized Dropbox folder, I had to deactivate it in order to obtain correct screenshot files.
So I'm digging through Capture.zgeproj and I have some questions:
How do we know that the exported image is a tga, other than by setting that in the file name?
Code: Select all
FrameFile.FileName = "Frame" + (Frame < 10 ? "0" : "") + intToStr(Frame) + ".tga";
Is there a size limit for FrameBuffer.SizeDim1? Could 1280x1024 fit in that?
Code: Select all
FrameBuffer.SizeDim1 = FrameWidth * FrameHeight << 2;
Not every exported images are readable. And sometimes the file size can vary (a lot) from one image to another, even if I deactivate the diamond rotation so the images are exactly the same.
Edit: Seems that last one is Dropbox's fault. Since I'm working inside the synchronized Dropbox folder, I had to deactivate it in order to obtain correct screenshot files.
Re: Exporting images from ZGE
Hi Ats,
K
Each file format stores data in a specific way .. just changing the file extension from TGA into BMP or PNG doesn't magically transform the data inside the file.Ats wrote:How do we know that the exported image is a tga, other than by setting that in the file name?
The reason why i went with TGA is because it's a very simple file format. You could write a exporter for BMP or PNG as well, but especially PNG is quite a bit of work.Ats wrote:Could that be a friendlier format, like bmp or png?
K
Re: Exporting images from ZGE
I needed a non-component version of this routine so I'm posting it here for future reference. This routine also need the OpenGL ZExternalLibrary from Kjells project.
Code: Select all
void saveScreenDump(string filename) {
//Based on code by Kjell http://www.emix8.org/forum/viewtopic.php?f=1&t=1156&p=7242&hilit=save+image#p7242
int w=App.ViewportWidth;
int h=App.ViewportHeight;
byte[18] header;
header[2] = 2;
header[16] = 32;
header[17] = 8;
header[12] = w;
header[13] = w >> 8;
header[14] = h;
header[15] = h >> 8;
byte[] buffer;
buffer.SizeDim1 = header.SizeDim1 + w*h*4;
int dst=0;
for(int i=0; i<header.SizeDim1; i++)
buffer[dst++]=header[i];
glReadPixels(App.ViewportX, App.ViewportY, w, h, 0x80E1, 0x1401, buffer[dst]);
@FileAction( File : @File(FileName : filename, Encoding : 1, TargetArray : buffer), Action : 1 );
}
Re: Exporting images from ZGE
Hi VilleK, did something critical changed in ZGE since last july?
Exporting images from ZGE as a TGA file don't work anymore. The file is created, but isn't recognized as anything![Confused :?](./images/smilies/icon_confused.gif)
Exporting images from ZGE as a TGA file don't work anymore. The file is created, but isn't recognized as anything
![Confused :?](./images/smilies/icon_confused.gif)
Re: Exporting images from ZGE
It should work. Did you try my non-component version above? I used it two weeks ago and it was working fine.
Re: Exporting images from ZGE
Nope. Then I guess it will work, I'm trying now.
But the previous one with the component isn't working anymore
Edit:
All right, your version is working perfectly and is almost instantaneous, while the previous one took many seconds per image. Perfect!
But the previous one with the component isn't working anymore
Edit:
All right, your version is working perfectly and is almost instantaneous, while the previous one took many seconds per image. Perfect!
Re: Exporting images from ZGE
Since I have Delphi installed, I compiled that pascal TGA2PNG converter: https://github.com/shusaura85/tga2png
It's working nicely just by dropping the tga on the exe.
![Laughing :lol:](./images/smilies/icon_lol.gif)
It's working nicely just by dropping the tga on the exe.
I took a look it's source code, and now I understand what you meantThe reason why i went with TGA is because it's a very simple file format. You could write a exporter for BMP or PNG as well, but especially PNG is quite a bit of work.
![Laughing :lol:](./images/smilies/icon_lol.gif)