When resizing an image that is not of jpeg type (e.g. png or gif), the resulting image is converted into jpeg, but the extension is maintained from the original. The resulting image can't be opened as the extension does not match the real image type anymore.