Question

i'm trying to use Wand to create a multi-size ico, but i don't find anything talking about that, only normal conversion, to ico... i've found "Sequences":

https://wand.readthedocs.org/en/latest/roadmap.html

and sequences look like what i need, but i only see samples trying to read the multiple images, but not how to create, am i missing something? or is not possible?

or is it possible to do using PIL/PILLOW?

Was it helpful?

Solution

You can append() a single image to Image.sequence list. For example:

from wand.color import Color
from wand.image import Image


with Image(width=32, height=32, background=Color('red')) as ico:
    with Image(width=16, height=16, background=Color('green')) as s16:
        ico.sequence.append(s16)
    ico.save(filename='multisized.ico')

Result (multisized.ico):

multisized.ico

OTHER TIPS

I had a similar problem, but with creating a multi-page PDF from multiple JPEG files. In Imagemagick i used command -adjoin. In Wand i did the following:

from glob import glob
from wand.image import Image

files = glob('*.jpg')
with Image() as orig: # create empty Image object
    for f in files:
        page = Image(filename=f)
        orig.sequence.append(page)
    orig.save(filename='result.pdf')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top