Slightly changing the jpg->png converter function