简体   繁体   中英

ImageMagick to Wand: problem with sparse-color Barycentric

I don't know how to convert an ImageMagick to Wand instruction.

convert beijing_contrast.jpg \
          -sparse-color Barycentric '0,0 black 0,%h white' \
          -function polynomial 4,-4,1   beijing_blurmap.jpg

img.function('polynomial', [4, -4, 1]) seems OK, but for -sparse-color instruction...

In Wand, the method Image.spase_color() can be called by passing a dict map.

Although you would not be able to use percent escape ( %h ) arguments.

with Image(filename='beijing_contrast.jpg') as img:
    points = {'black': (0, 0), 'white': (0, img.height)}
    img.sparse_color('barycentric', points)
    img.function('polynomial', [4, -4, 1])
    img.save(filename='beijing_blurmap.jpg')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM