Make previews generate black border and resize images correctly