“动画和gif文件制作”的版本间差异
		
		
		
		
		
		跳到导航
		跳到搜索
		
				
		
		
	
|  (以“*生成mpeg的xinteranimate命令中,需要预先定义视频到帧数  *在生成gif文件的  write_gif命令,只需要定义 /multiple,可以一直写入 :g...”为内容创建页面) | 无编辑摘要 | ||
| (未显示同一用户的2个中间版本) | |||
| 第5行: | 第5行: | ||
| :在设置device,decomposed=0 (8位伪彩色)的时候,屏幕显示颜色完全正确,但在生成的gif文件中的颜色表似乎是按照真彩色来的。 | :在设置device,decomposed=0 (8位伪彩色)的时候,屏幕显示颜色完全正确,但在生成的gif文件中的颜色表似乎是按照真彩色来的。 | ||
| :设置device,decomposed=1,屏幕显示不对,但gif文件中正确。 | :设置device,decomposed=1,屏幕显示不对,但gif文件中正确。 | ||
|  pro animate | |||
|  xh=800 & yh=600 & n=100 | |||
|  device,retain=2 | |||
|  ; | |||
|  x=findgen(628)*0.01 | |||
|  xinteranimate,20,set=[xh,yh,n],/mpeg_open,mpeg_quality=100,$ | |||
|  mpeg_filename='sinx.mpg',title='Example' | |||
|  ; | |||
|  window,0,xsize=xh,ysize=yh | |||
|  for i=0,n-1 do begin | |||
|    plot,x,sin(x-i*0.05),xstyle=1,ystyle=1,title='sin(x) is moving...' | |||
|    WRITE_GIF, 'test.gif', TVRD(),/multiple | |||
|    xinteranimate,frame=i,window=0 | |||
|  endfor | |||
|  xinteranimate,/mpeg_close,/close | |||
|  end | |||
| [[category:IDL]] | |||
2012年4月7日 (六) 13:36的最新版本
- 生成mpeg的xinteranimate命令中,需要预先定义视频到帧数
- 在生成gif文件的 write_gif命令,只需要定义 /multiple,可以一直写入
- gif是8位的颜色,而device的默认是24位颜色。
- 在设置device,decomposed=0 (8位伪彩色)的时候,屏幕显示颜色完全正确,但在生成的gif文件中的颜色表似乎是按照真彩色来的。
- 设置device,decomposed=1,屏幕显示不对,但gif文件中正确。
pro animate xh=800 & yh=600 & n=100 device,retain=2 ; x=findgen(628)*0.01 xinteranimate,20,set=[xh,yh,n],/mpeg_open,mpeg_quality=100,$ mpeg_filename='sinx.mpg',title='Example' ; window,0,xsize=xh,ysize=yh for i=0,n-1 do begin plot,x,sin(x-i*0.05),xstyle=1,ystyle=1,title='sin(x) is moving...' WRITE_GIF, 'test.gif', TVRD(),/multiple xinteranimate,frame=i,window=0 endfor xinteranimate,/mpeg_close,/close end