imaging icon indicating copy to clipboard operation
imaging copied to clipboard

how can we resize image

Open lilei10101010 opened this issue 3 years ago • 3 comments

Hi buddy , My Code is :

src2,_:=imaging.Open("./screen.png") //screen.png is px is 160*60 imaging.Resize(src2,320,120,imaging.Lanczos)

err = imaging.Save(src2,"./example02.png")

it can`t work , example02.png also is 160*60

how can i resize the bigger image ?

lilei10101010 avatar Oct 23 '21 16:10 lilei10101010

Hi, The Resize function returns the new (resized) image. Try changing the second line this way:

src2 = imaging.Resize(src2, 320, 120, imaging.Lanczos)

disintegration avatar Oct 24 '21 22:10 disintegration

It`s okay , thanks buddy !

lilei10101010 avatar Oct 25 '21 14:10 lilei10101010

Hi @disintegration , I have used imaging for sometimes, and faced an issue when resizing images.

It's corrupted, resulting image in grey blocks as following attachment. Can you please tell me what is the root cause? Thanks a lot.

image

vunguyen1989 avatar Feb 19 '24 04:02 vunguyen1989