Decode images only up to a maximum size