xiaomickey
31st May 2006, 03:40
learn from http://forum.doom9.org/showthread.php?t=108818
i change it like this
temp = Photo("1.jpg")
c = temp
last=c
ImageWriter("G:\", start = 0, type = "jpg", info = true)
function Photo(string image)
{
t = ImageSource(image, end = 0, use_DevIL=true)
x = t.width
y = t.height
m = 0
n = 0
t = (x > 640) ? t.Addborders(0, ((x-640)/2)/4*3, 0, ((x-640)/2)/4*3, 0) : t.Addborders((640-x)/2, 0, (640-x)/2, 0, 0)
t = (y > 480) ? t.Addborders(((y-480)/2)/3*4, 0, ((y-480)/2)/3*4, 0, 0) : t.Addborders(0, (480-y)/2, 0, (480-y)/2, 0)
t = t.ConvertToRGB32().BilinearResize(640,480)
return t
}
it works well
but it do not fit the picture width > 640 && height > 480
then i change like this
temp = Photo("1.jpg")
c = temp
last=c
ImageWriter("G:\", start = 0, type = "jpg", info = true)
function Photo(string image)
{
t = ImageSource(image, end = 0, use_DevIL=true)
x = t.width
y = t.height
t = (x/4*3 > y) ? t.Addborders(0, (x/4*3-y)/2, 0, (y/3*4-x)/2, 50) : t.Addborders((y/3*4-x)/2, 0, (y/3*4-x)/2, 0, 50)
t = t.ConvertToRGB32().Lanczos4Resize(640,480)
return t
}
but strangely it doesnt work i dont know why :(
and ..... sorry for my poor english..... :o
i change it like this
temp = Photo("1.jpg")
c = temp
last=c
ImageWriter("G:\", start = 0, type = "jpg", info = true)
function Photo(string image)
{
t = ImageSource(image, end = 0, use_DevIL=true)
x = t.width
y = t.height
m = 0
n = 0
t = (x > 640) ? t.Addborders(0, ((x-640)/2)/4*3, 0, ((x-640)/2)/4*3, 0) : t.Addborders((640-x)/2, 0, (640-x)/2, 0, 0)
t = (y > 480) ? t.Addborders(((y-480)/2)/3*4, 0, ((y-480)/2)/3*4, 0, 0) : t.Addborders(0, (480-y)/2, 0, (480-y)/2, 0)
t = t.ConvertToRGB32().BilinearResize(640,480)
return t
}
it works well
but it do not fit the picture width > 640 && height > 480
then i change like this
temp = Photo("1.jpg")
c = temp
last=c
ImageWriter("G:\", start = 0, type = "jpg", info = true)
function Photo(string image)
{
t = ImageSource(image, end = 0, use_DevIL=true)
x = t.width
y = t.height
t = (x/4*3 > y) ? t.Addborders(0, (x/4*3-y)/2, 0, (y/3*4-x)/2, 50) : t.Addborders((y/3*4-x)/2, 0, (y/3*4-x)/2, 0, 50)
t = t.ConvertToRGB32().Lanczos4Resize(640,480)
return t
}
but strangely it doesnt work i dont know why :(
and ..... sorry for my poor english..... :o