Is there any easy way to resize an image down to a certain specified size?
Possibly a 3d way to do that?
Image Resizeing
Moderators: Shine, Insert_witty_name
There is a way to do it. I think someone posted this function, I just modified it a bit.
If you wanted to use the Gu/Gum functions to scale the image you would need to add sceGumScale() to lua player.
and then to scale the image, lets say 2x, in lua after your regular 3d stuff:
It will resize the x and y by 2 and keep the z the same.
You can expect to see the function in lua player mod 4.
Code: Select all
function scaleImage(newX, newY, theImage)
newImage = Image.createEmpty(newX, newY)
for x = 0, newX do
for y = 0, newY do
newImage:blit(x,y , theImage, math.floor(x*(theImage:width()/newX)),math.floor(y*(theImage:height()/newY)), 1, 1)
end
end
return newImage
end
image = Image.load("blah")
scaledimage = scaleImage(newx,newy,image)
Code: Select all
static int lua_sceGumScale(lua_State *L) {
int argc = lua_gettop(L);
if (argc != 3) return luaL_error(L, "wrong number of arguments");
ScePspFVector3 v;
v.x = luaL_checknumber(L, 1);
v.y = luaL_checknumber(L, 2);
v.z = luaL_checknumber(L, 3);
sceGumScale(&v);
return 0;
}
and {"scale", lua_sceGumScale}, in the correct spot
Code: Select all
Gum.scale(2,2,1)
You can expect to see the function in lua player mod 4.