Sibi
Sibi

Reputation: 2421

Set image size in lua

I have written the following code to display an image in lua:

imagefile="/path/"
img=image.load(imagefile)
image.display(img)

The dimensions of the image are 200x200. How can I resize the image to 100*100 or some other dimensions?

Upvotes: 1

Views: 4749

Answers (1)

Oleg V. Volkov
Oleg V. Volkov

Reputation: 22431

There are no image manipulation in default environment. Names of your tables and functions seems to match Torch though. If that's the case, use image.scale.

Relevant quote from docs (https://github.com/torch/image/blob/master/doc/simpletransform.md#res-imagescalesrc-width-height-mode):

image.scale(src, width, height, [mode])

Rescale the height and width of image src to have width width and height height. Variable mode specifies type of interpolation to be used. Valid values include bilinear (the default), bicubic, or simple interpolation. Returns a new res Tensor.

Upvotes: 2

Related Questions