Resize

new topic     » topic index » view thread      » older message » newer message

Here's an image resizing routine I just did.
Probably been done before, I suppose...
   ...anyway:

s is the origional image
dim is the target dimensions {x,y}

function resize(sequence s,sequence dim)
    -- HMI Image Re-Size
    sequence r,temp
    integer n
    atom f,p
    f=length(s)/dim[2]
    r={s[1]} p=1 n=2
    while n<=dim[2] do
        r=append(r,s[floor(p)])
        p=p+f n=n+1
    end while
    f=length(s[1])/dim[1]
    for y=1 to length(r) do
        temp={} p=1 n=1
        while n<=dim[1] do
            temp=temp&r[y][floor(p)]
            p=p+f n=n+1
        end while
        r[y]=temp
    end for
    return r
end function


Graeme.
----------------------------------------------------

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu