emcconville / wand

The ctypes-based simple ImageMagick binding for Python
http://docs.wand-py.org/
Other
1.4k stars 197 forks source link

img.resolution is (0.0, 0.0), but img.size work well. #613

Open 668168 opened 1 year ago

668168 commented 1 year ago

ENV:

wand.version.VERSION: 0.6.11 windows server 2022 python 3.8.10

INPUT

from wand.image import Image
with Image(filename='images/hummingbird.jpg' ,units='pixelsperinch') as img: # 330, 252
    print(f"size: {img.size}")
    print(f"resolution: {img.resolution}")

OUTPUT

size: (330, 252) resolution: (0.0, 0.0)

emcconville commented 1 year ago

Thanks for posting. I'm unable to reproduce this. Can you run the following, and share the output?

python -m wand.version --verbose

Also, try the following...

identify -units pixelperinch -format '%x %y %U\r\n' images/hummingbird.jpg
668168 commented 1 year ago

sorry for a long holiday.

PS D:\code> python -m wand.version --verbose
Wand 0.6.11
ImageMagick 7.1.0-57 Q16-HDRI x64 eadf378:20221230 https://imagemagick.org
PS D:\code> 

D:\code>magick identify -units pixelperinch -format '%x %y %U\r\n' images/hummingbird.jpg 
identify: unrecognized units type `pixelperinch' @ error/identify.c/IdentifyImageCommand/880.

D:\code>magick identify  -format '%x %y %U\r\n' images/hummingbird.jpg                    
identify: unable to open image '%y': No such file or directory @ error/blob.c/OpenBlob/3570.
identify: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.
identify: unable to open image '%U\r\n'': No such file or directory @ error/blob.c/OpenBlob/3570.
identify: unable to open image '%U\r\n'': No such file or directory @ error/blob.c/OpenBlob/3570.
identify: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.
'72
D:\code>magick identify   images/hummingbird.jpg                       
images/hummingbird.jpg WEBP 330x252 330x252+0+0 8-bit sRGB 22520B 0.016u 0:00.002

D:\code>