Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions UnityPy/export/Texture2DConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ def pad_image(img: Image.Image, pad_width: int, pad_height: int) -> Image.Image:
if pad_width == ori_width and pad_height == ori_height:
return img

pad_img = Image.new(img.mode, (pad_width, pad_height))
pad_img.paste(img)

# Paste the original image at the top-left corner
pad_img = Image.new(img.mode, (pad_width, pad_height))
pad_img.paste(img, (0, 0))

# Fill the right border: duplicate the last column
Expand Down Expand Up @@ -259,15 +257,6 @@ def image_to_texture2d(
return enc_img, tex_format


def assert_rgba(img: Image.Image, target_texture_format: TextureFormat) -> Image.Image:
if img.mode == "RGB":
img = img.convert("RGBA")
assert img.mode == "RGBA", (
f"{target_texture_format} compression only supports RGB & RGBA images"
) # noqa: E501
return img


def get_image_from_texture2d(
texture_2d: Texture2D,
flip: bool = True,
Expand Down Expand Up @@ -341,8 +330,7 @@ def parse_image_data(
if not selection:
raise NotImplementedError(f"Not implemented texture format: {texture_format}")

if not isinstance(image_data, bytes):
image_data = bytes(image_data)
image_data = bytes(image_data)

if "Crunched" in texture_format.name:
if (
Expand Down