-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Description
Greetings!
I'm trying to rotate an image 45° without any interpolation (Well, GIMP calls it "None" so i suppose its without interpolation)
But i can't figure out how to change it, anything i type returns unsupported gtype for set VipsInterpolate
This is my code:
local vips = require("lua-vips")
local base = vips.Image.new_from_file("thumbnail_base.png")
print("Enter Path of Sprite:")
local sprite = io.read()
local sprite_img = vips.Image.new_from_file(sprite)
local sprite_height = sprite_img:height()
local sprite_width = sprite_img:width()
local biggest_size = ((sprite_height>sprite_width) and sprite_height) or ((sprite_width>sprite_height) and sprite_width) --Gives me the biggest size (if image is 20x10, gives me 20)
if sprite_height == sprite_width then --If both sizes are the same (like 10x10) it just gives me 10
biggest_size = sprite_height
end
print(biggest_size)
sprite_img = sprite_img:gravity("centre", biggest_size*1, biggest_size*1) --Adds empty space around the sprite
sprite_img:pngsave("sprite_step1_cropped.png")
sprite_img = sprite_img:resize(2, {kernel="VIPS_KERNEL_NEAREST"}) --Scales the sprite up A LOT
sprite_img:pngsave("sprite_step2_resized.png")
if (sprite_img:height() % 2) == 0 then
sprite_img = sprite_img:gravity("centre", sprite_img:height()+1, sprite_img:height()+1) --If the sprite is not odd, adds 1 to the height and width
sprite_img:pngsave("sprite_step3_resized2.png")
end
sprite_img = sprite_img:rotate(45, {interpolate="No idea what to put here"}) --Rotates the sprite 45° <<<<<< THIS IS WHERE I'M CONFUSED
sprite_img:pngsave("sprite_step4_rotated.png")
local sprite_width2 = sprite_img:width() --Gets the sprite's width again
sprite_img = sprite_img:resize(256/sprite_width2) --Returns the sprite to 256x256 resolution
sprite_img:pngsave("sprite_step5_resized3.png")
base = base:add(sprite_img) --Adds the sprite on top of the thumbnail_base
base:pngsave("x.png") --Exports the final resultAny idea how i can change/disable interpolation? Or if its even possible?
Metadata
Metadata
Assignees
Labels
No labels