dplaton
13th July 2005, 13:59
I want to resize according to the size of the still
I have a 419x311 still
The final size is 719x575 and not 720x576
What I'm wrong?
Here is the code
a = "E:\baie\La_baie_1.tif"
# size 413x311
a = ImageReader (a , start, end, 25).ResizeDupaCaz ()
return a
Function ResizeDupaCaz ( clip c ) {
#With size to resize
Wsize = 672
#Test if clip size < Wsize NO then resize
WResize = (Width(c) > Wsize) ? Wsize : Width(c)
#set the Height resize according to Wresize
HResize = Round(Height(c) * WResize/Width(c))
#even Height check and adjust
HResize = (HResize/2 == int(HResize/2)) ? HResize : (HResize-1)
#resize down if is the case
c = c.BilinearResize (WResize, HResize)
#the case With clip < Wresize
#even With check and adjust
cutW = (Width(c)/2 == (Round(Width(c)/2))) ? 0 : 1
#Height cutting value if Height > 576
cutH = Height(c) - 576
#adjust Height cutting value if Height < 576
cutH = (cutH <= 0) ? 0 : cutH
# even Height check and adjust
cutH = (cutH/2 == Round(cutH/2)) ? 0 : (cutH+1)
c = c.Crop(0, cutH/2, cutW, cutH/2)
borderW = 720 - Width(c)
borderH = 576 - Height(c)
AddBorders (c, borderW/2, borderH/2, borderW/2, borderH/2)
return last
}
I have a 419x311 still
The final size is 719x575 and not 720x576
What I'm wrong?
Here is the code
a = "E:\baie\La_baie_1.tif"
# size 413x311
a = ImageReader (a , start, end, 25).ResizeDupaCaz ()
return a
Function ResizeDupaCaz ( clip c ) {
#With size to resize
Wsize = 672
#Test if clip size < Wsize NO then resize
WResize = (Width(c) > Wsize) ? Wsize : Width(c)
#set the Height resize according to Wresize
HResize = Round(Height(c) * WResize/Width(c))
#even Height check and adjust
HResize = (HResize/2 == int(HResize/2)) ? HResize : (HResize-1)
#resize down if is the case
c = c.BilinearResize (WResize, HResize)
#the case With clip < Wresize
#even With check and adjust
cutW = (Width(c)/2 == (Round(Width(c)/2))) ? 0 : 1
#Height cutting value if Height > 576
cutH = Height(c) - 576
#adjust Height cutting value if Height < 576
cutH = (cutH <= 0) ? 0 : cutH
# even Height check and adjust
cutH = (cutH/2 == Round(cutH/2)) ? 0 : (cutH+1)
c = c.Crop(0, cutH/2, cutW, cutH/2)
borderW = 720 - Width(c)
borderH = 576 - Height(c)
AddBorders (c, borderW/2, borderH/2, borderW/2, borderH/2)
return last
}