#include Once "window9.bi"

Function Save_imagea(Byval GpImage As Any Ptr, Byref sFileName As String) As Integer
	
	If GpImage Then
		
		Dim As String sExtension = Lcase(Getextensionpart(sFileName))
		
		If sExtension = "jpg" Then sExtension = "jpeg"
		
		Dim As Gerror Ptr err_
		
		Function = gdk_pixbuf_save(GpImage, Strptr(sFileName), Strptr(sExtension), @err_, NULL)
		
	Endif
	
End Function