python 3.x - Wand Image from PDF doesn't apply resizing -


i'm using wand in django project, generate thumbnail different kind of files, e.g pdf, thumbnail generation process done in memory, source file request , thumbnail saved temporary file, django filefiled saves image in correct path, thumbnail generated keeps initial size, code:

with image.image(file=self.content.file, format="png") im: # self.content django model filefield didn't saved yet, file inside still in memory (from request)     im.resize(200, 200)     name = self.content.file.name     self.temp = tempfile.namedtemporaryfile()     im.save(file=self.temp)     self.thumbnail = inmemoryuploadedfile(self.temp, none, name + ".png", 'image/png', 0, 0, none)  # self.thumnail filefield saves image 

do have idea happen? bug? i've reported issue on wand github page.

the problem comes fact pdf has more 1 page. if resize first page (which 1 want display), works. try adding following line after with statement:

im = image.image(image=im.sequence[0]) 

but agree version should work well.


Popular posts from this blog