Yamipa

Yamipa

3.7k Downloads

Resize options to keep aspect ratio

goweiwen opened this issue · 2 comments

commented

Currently, we can only stretch the image to fit within an integer width and height.

It would be nice to support contain (keep aspect ratio and stay within bounds) and cover (keep aspect ratio and crop to bounds) by padding the image with transparent pixels.

For reference, ImageOnMap can do this:

You can change the scaling method by replacing the resize keyword in the /tomap command by:
resize-stretched to stretch the image to the surface (the image could be distorted); or
resize-covered to ensure the image covers the whole surface (the image will never be distorted, but some parts may be lost near the borders).

commented

Hi, @goweiwen!

I don't have much interest in adding that feature. I think it'll complicate the "place" command and might confuse some players.

If you want to place pixel-perfect images, you can always use PNG files with transparency for that purpose. Just make sure the width and height are multiple of 128 pixels (each block will hold 128x128 pixels).

commented

I'd like this feature too, it would be nice to not have to spend time tediously resizing each image I'd like to import in order to maintain its aspect ratio. If this feature were added as a flag such as COVER and CONTAIN, I'm sure the place command won't be complicated by very much (as no new arguments are needed), and thus could be understood by new players.