Re: [wand] How to resize with extent
- Hong Minhee
- 2013-11-25 @ 03:07
I think resize() function you pasted could be directly ported to Python
from wand.image import Image
def resize(src, dst):
with Image(filename=src) as src_image:
with Image(width=300, height=460) as dst_image:
dst_image.composite(src_image, 0, 0)
On Mon, Nov 25, 2013 at 4:55 AM, Timur Tabi <firstname.lastname@example.org> wrote:
> I have a bash shell script that manipulates images with ImageMagick,
> and I'm trying to convert it into a Python script that uses Wand.
> Unfortunately, I'm not very good at Python, so a lot of things about
> Wand confuse me.
> I'm trying to convert this bash function into python+wand:
> function resize()
> convert $1 -resize 300x420 -extent 300x460 $2
> I get that 'resize' is handle with img.size(), but what about the
> extent? Is there a an easy way to handle that?
> I'm guessing that I'm going to have to create a blank 300x460 image
> and then merge my resized image onto that one. I can probably figure
> that out.