RyanAWalters / PowerOf2ImageResizer

Power of 2 Image Resizer for Game Engine Textures
31 stars 3 forks source link

Length/Width independent #1

Open Luke003 opened 2 years ago

Luke003 commented 2 years ago

Would it be possible to have the width and height considered independently so that the output isn't always square? I see there is another fork that does that (specific to toontown), but I'm wondering if it can be included in the installer so I can continue to use the shell extension.

loonaticx commented 2 years ago

For my custom fork, I did the get_closest function separately for both the width/height values:

def po2(im):
    name = im.filename
    width, height = im.size
    new_dimX = get_closest(width)
    new_dimY = get_closest(height)
    # ...
    return im.resize((new_dimX, new_dimY))

This current branch does:

def po2(im, ...):
  new_dim = max(get_closest(width), get_closest(height))
  # ...
  return im.resize((new_dim, new_dim), resample=Image.BICUBIC)
Luke003 commented 2 years ago

For my custom fork, I did the get_closest function separately for both the width/height values:

def po2(im):
    name = im.filename
    width, height = im.size
    new_dimX = get_closest(width)
    new_dimY = get_closest(height)
    # ...
    return im.resize((new_dimX, new_dimY))

This current branch does:

def po2(im, ...):
  new_dim = max(get_closest(width), get_closest(height))
  # ...
  return im.resize((new_dim, new_dim), resample=Image.BICUBIC)

Thanks. I saw that, and that's similar to the changes I made myself. I excluded the color profile changes and kept the full spectrum of sizes.

Does the new fork include that in the installation package though? I find the shell extension functionality incredibly useful and am not familiar enough with compiling python to figure it out. I originally thought that editing the python script before running the install would implement it, but it appears they are not connected.