You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into this issue while trying to replace texture2d assets with modified versions of the same image. Obviously, this seems to be an etcpak error which I understand is a dependency issue. I just wanted to ask if I'm missing something obvious that would easily fix this, or if there's not much that can be done without fixing the dependency. Maintaining the image's dimension is key so resizing is not really great.
Code
env=UnityPy.load(f)
forobjinenv.objects:
ifobj.type.name=='Texture2D':
data=obj.read()
# getting file from somewheretexture_path=file.absolute()
new_texture=Image.open(texture_path)
# Fails at this linedata.image=new_texturedata.save()
Error
Traceback (most recent call last):
File "...\asset_replace.py", line 63, in main
data.image = new_texture
File "Python\Python310\lib\site-packages\UnityPy\classes\legacy_patch\Texture2D.py", line 28, in _Texture2d_set_image
img_data, tex_format = Texture2DConverter.image_to_texture2d(img, target_format)
File "Python\Python310\lib\site-packages\UnityPy\export\Texture2DConverter.py", line 68, in image_to_texture2d
enc_img = etcpak.compress_etc2_rgba(raw_img, img.width, img.height)
ValueError: width or height not multiple of 4
Bug
UnityPy unable to work with images of height or width that aren't multiples of 4
To Reproduce
Test Image is 506 x 434
following data:
Python 3.10
UnityPy 1.20.16
The text was updated successfully, but these errors were encountered:
I ran into this issue while trying to replace texture2d assets with modified versions of the same image. Obviously, this seems to be an etcpak error which I understand is a dependency issue. I just wanted to ask if I'm missing something obvious that would easily fix this, or if there's not much that can be done without fixing the dependency. Maintaining the image's dimension is key so resizing is not really great.
Code
Error
Bug
UnityPy unable to work with images of height or width that aren't multiples of 4
To Reproduce
The text was updated successfully, but these errors were encountered: