bug in fx function

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
sara_shafaei
Posts: 9
Joined: 2012-01-12T08:06:23-07:00
Authentication code: 8675308

bug in fx function

Post by sara_shafaei »

It seems that virtualpixelmethod is not working in fx function anymore. I installed imagemagick 6.8.7-8 on my windows machine, I had imagemagick 6.8.0-10 on my mac. When I run the same command, I am getting different result. the command is:
convert -size 1096x1 xc: -virtual-pixel black -fx "xc=548; xd=(i-xc)/172; ffx=(1/pi)*asin(xd); xs=0.5*(ffx+(xc-i)/(xc))+0.5; xd>1?1:xs" -scale 1096x309! "out.png"

so in new version, pixels that should be assigned with virtual pixel ( which is black here), they have values. Is it brokenin this version? Can u please advise me on that.
Thanks,
~Sara
sara_shafaei
Posts: 9
Joined: 2012-01-12T08:06:23-07:00
Authentication code: 8675308

Re: bug in fx function

Post by sara_shafaei »

Can someone in ImageMagick please help me with that?
Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bug in fx function

Post by fmw42 »

I get results that are identical when using IM 6.8.8.2 and 6.8.6.8 on Mac OSX Snow Leopard. In both cases, the left third is black, the middle third is gray and the right third is white.

What do you think is the correct result? Can you post a link to your correct image? You post to some free image hosting service such as dropbox and put a link here.
sara_shafaei
Posts: 9
Joined: 2012-01-12T08:06:23-07:00
Authentication code: 8675308

Re: bug in fx function

Post by sara_shafaei »

Thanks for your reply. I upload the result here:
https://www.dropbox.com/home/imagemagick_result

first one (correct.png), I got it from IM 6.8.0-10 in my mac OSX Lion, which is suppose to be like that.
second one(wrong.png), I got it from IM 6.8.7-8 in Parallel (virtual machine ) , Windows 7 on same machine (mac-Lion).
I used exactly same command for both. Anything else work great, it is just this one, which I am guessing is fx doesn't pick up virtual method. virtualmethod is working for other places, just not working in fx.

Thanks again,
~Sara
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: bug in fx function

Post by snibgo »

Your link is bad. It works for you because you are logged into your dropbox account. You need to find the links to your pictures, and paste those here.
snibgo's IM pages: im.snibgo.com
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: bug in fx function

Post by snibgo »

I'm not an expert at fx, but I can't see how virtual-pixel can make a difference. The output colour depends only on "i", not on anything else.

But I could be wrong.
snibgo's IM pages: im.snibgo.com
sara_shafaei
Posts: 9
Joined: 2012-01-12T08:06:23-07:00
Authentication code: 8675308

Re: bug in fx function

Post by sara_shafaei »

Sorry for the bad links, here another one:
correct: http://imgur.com/uxxbu7Y,8Neapcc#0
wrong: http://imgur.com/uxxbu7Y,8Neapcc#1
sara_shafaei
Posts: 9
Joined: 2012-01-12T08:06:23-07:00
Authentication code: 8675308

Re: bug in fx function

Post by sara_shafaei »

Some area that there is no value for them are filled by virtual pixel, and image has problems in those areas.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bug in fx function

Post by fmw42 »

I get results that are identical to your good result when using IM 6.8.8.2 and 6.8.6.8 on Mac OSX Snow Leopard. In both cases, the left third is black, the middle third is gray and the right third is white.

This may be a Windows only issue.
sara_shafaei
Posts: 9
Joined: 2012-01-12T08:06:23-07:00
Authentication code: 8675308

Re: bug in fx function

Post by sara_shafaei »

So it maybe problem in 6.8.7-8 and it is fixed in IM 6.8.8.2. If I switch to IM 6.8.8.2 that may solve the problem.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bug in fx function

Post by fmw42 »

sara_shafaei wrote:So it maybe problem in 6.8.7-8 and it is fixed in IM 6.8.8.2. If I switch to IM 6.8.8.2 that may solve the problem.
Yes, it is possible it is a bug in just that version 6.8.7-8. But I ran your command against 6.8.7.8 in Mac OSX and it works just fine.

perhaps in Windows you need to escape the ! as ^! or put the whole value in double quotes.

convert -size 1096x1 xc: -virtual-pixel black -fx "xc=548; xd=(i-xc)/172; ffx=(1/pi)*asin(xd); xs=0.5*(ffx+(xc-i)/(xc))+0.5; xd>1?1:xs" -scale 1096x309^! out.png

or

convert -size 1096x1 xc: -virtual-pixel black -fx "xc=548; xd=(i-xc)/172; ffx=(1/pi)*asin(xd); xs=0.5*(ffx+(xc-i)/(xc))+0.5; xd>1?1:xs" -scale "1096x309!" out.png
Post Reply