As far as I can tell, that's the only way. When I look through my book, I find that they have
imagecreate(width, height)
imagecreatefromgif(filename)
imagecreatefromjpeg(filename)
imagecreatefrompng(filename)
I'm not sure exactly what those do, but I hope there helpful.