output dir generation, gm resizing in loop