First implementation for scaling large images