Posted: 17th Dec 2018 20:38
+ Code Snippet
set bitmap format 21

sync on : sync rate 30
backdrop off
sync

type png
	id as integer
	st as integer
	ed as integer
endtype

`filen$="pdf2word_new.ico"
`filen$="battery.ico"
`filen$="bluetooth.ico"
`filen$="action.ico"
`filen$="display.ico"
`filen$="APIFile_8.ico"
`filen$="audio.ico"
filen$="touch.ico"

out$=change fileext$(filen$,".txt")
fid=reserve free file()
mbid=reserve free memblock()

if file exist(filen$)
open to read fid,filen$
make memblock from file mbid,fid
close file fid
release reserved file fid

mbsz = get memblock size(mbid)
mbptr = get memblock ptr(mbid)

dim image() as png

if file exist(out$)=1 then delete file out$
open to write 1,out$
imid=0
for fb=0 to mbsz-1
	byt = memblock byte(1,fb) 
	s$=peek string(mbptr+fb,4)
	if upper$(s$)=chr$(137)+"PNG"
		array insert at bottom (image())
		inc imid
		image().id=imid
		image().st=fb
		write string 1,"PNG image id = "+str$(image().id)+"   mem ptr start pos = "+str$(image().st) _
		+"   mb start pos = "+str$(fb)+"   string : "+s$		
	endif
	if upper$(s$)="IEND"
		image().ed=fb+3
		write string 1,"PNG image id = "+str$(image().id)+"   mem ptr end pos = "+str$(image().ed) _
		+"   mb end pos = "+str$(fb+3)+"   string : "+s$		
	endif
	write string 1,"fb : "+str$(fb)+"   byte : "+str$(byt)
next fb
close file 1

if imid =0 
	message "No PNG files found in ICO file. Ending..."
	end
else
	imgcnt = array count(image())
	for img = 0 to imgcnt
		if str$(image(0).st) <> "" and str$(image(0).ed) <> ""
			pngshortfname$=change fileext$(filen$,"")
			pngoutfile$=pngshortfname$+str$(image(img).id)+".png"
			if file exist(pngoutfile$) =1 then delete file pngoutfile$
			open to write 2,pngoutfile$
			sz = image(0).ed - image(0).st+1
			pngmb = find free memblock()
			make memblock pngmb,sz
			copy memblock 1,pngmb,image(0).st,0,sz
			make file from memblock 2,pngmb 
			close file 2
		endif 
	next img
	
	endif
endif
Posted: 17th Feb 2019 6:16
added code back in. extracts png files from ico file and saves the png files out. example ico attached 1st post. code very basic, but works ok.