set image format not ctx->inf but return value of MagickGetImageFormat

ctx->inf is Content-Type.(for example, image/jpeg).