0

enter image description here

I'm trying to create high res jpegs from a pdf using wand. This question is a follow up to How to create high res JPEG with Wand.

I'm getting the error:

with ok.transform('2000x1000', '100%') as image:
AttributeError: __enter__

Trying to step through the code:

Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)] on win32
>>> im = ok.transform('2000x1000', '100%') 
>>> im
>>> im

you can see that I am unable to assign the transformed image to im. Why ?

user1592380
  • 34,265
  • 92
  • 284
  • 515

1 Answers1

1

you can see that I am unable to assign the transformed image to im. Why ?

The method wand.image.Image.transform does not return an instance of wand.image.Image.

Also note. The MagickWand convenience method MagickTransformImage has been removed with IM-7. Use wand.image.Image.crop & wand.image.Image.resize directly.

with Image(filename=file_path, resolution=400) as image:
    image.crop(width=2000, height=1000)
emcconville
  • 23,800
  • 4
  • 50
  • 66