ImageMagick反射 [英] ImageMagick Reflection

查看:125
本文介绍了ImageMagick反射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简介:

  convert(-size 585x128 gradient:)NewImage.png 

如何更改上面的ImageMagick命令,以便从现有图像中获取宽度和高度?我需要它保持一行命令。






详细信息:

我试图以编程方式使用ImageMagick创建图像反射。我寻找的效果与在水池边缘看物体时看到的效果类似。有一个很好的线索,我正在尝试做什么这里,但解决方案并不完全符合我的要求。因为我将从C#.Net应用程序调用ImageMagick,所以我想使用一个没有任何临时文件的调用并通过stdout返回图像。到目前为止,我有这个...

  convert OriginalImage.png(OriginalImage.png -flip -blur 3x5 \ 
-crop 100 %% x30 %% + 0 + 0 -negate -evaluate multiply 0.3 \
-negate(-size 585x128 gradient:)+ matte -compose copy_opacity -composite)
-append NewImage。 png

这可以正常工作,但不会给我准确的淡入淡出效果。它从上到下给我一个从左上到右下的淡入淡出。我添加了(-negate -evaluate multiply 0.3 -negate)部分以减轻它的多一点,因为我没有得到我想要的淡入淡出效果。我也不想在创建渐变时使用图像大小的硬编码(-size 585x128渐变:)如果可能,我还想保留原始图像的透明度。



转到stdout我打算用 - 替换NewImage.png。

解决方案

如果你从C#调用它,也许你可以在C#中检索图像尺寸。
然后用

 命令调用ImageMagick命令= String.Format(convert bar%1x%2,img .Width,img.Height)


Brief:

convert ( -size 585x128 gradient: )  NewImage.png

How do I change the above ImageMagick command so it takes the width and height from an existing image? I need it to remain a one line command.


Details:

I'm trying to programatically create an image reflection using ImageMagick. The effect I am looking for is similar to what you would see when looking at an object on the edge of a pool of water. There is a pretty good thread on what I am trying to do here but the solution isn't exactly what I am looking for. Since I will be calling ImageMagick from a C#.Net application I want to use one call without any temp files and return the image through stdout. So far I have this...

convert OriginalImage.png  ( OriginalImage.png -flip -blur 3x5 \
    -crop 100%%x30%%+0+0 -negate -evaluate multiply 0.3 \
    -negate  ( -size 585x128 gradient: ) +matte -compose copy_opacity -composite )
    -append NewImage.png

This works ok but doesn't give me the exact fade I am looking for. Instead of a nice solid fade from top to bottom it is giving me a fade from top left to bottom right. I added the (-negate -evaluate multiply 0.3 -negate) section in to lighten it up a bit more since I wasn't getting the fade I wanted. I also don't want to have to hard code in the size of the image when creating the gradient ( -size 585x128 gradient: ) I'm also going to want to keep the original image's transparency if possible.

To go to stdout I plan on replacing "NewImage.png" with "-"

解决方案

If you are calling it from C#, perhaps you could get retrieve the image dimensions in C#. Then call the ImageMagick command with

command = String.Format("convert bar %1x%2",img.Width,img.Height)

这篇关于ImageMagick反射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆