Page 1 of 1
-fx fails in one case
Posted: 2014-10-03T14:38:42-07:00
by GreenKoopa
Code: Select all
convert rose: -evaluate Set 50% test_1.png
convert rose: -fx "0.5" test_2.png
convert in.tif -evaluate Set 50% test_3.png
convert in.tif -fx "0.5" test_4.png
The first three test cases result in a gray image as expected. The forth results in a black image. Has anyone encountered this before?
in.tif is 78MB, 16MP, 16-bit RGB tif output from Adobe Lightroom 5.5. IM reports warnings on some tags, but these files are handled properly outside of -fx. This happens using more than one such file. I can upload it tonight if needed.
This happens with the current version of IM, as well as a months old version.
Re: -fx fails in one case
Posted: 2014-10-03T15:55:40-07:00
by snibgo
On IM v6.8.9-5, on Windws 8.1, I can't reproduce the problem.
Code: Select all
F:\web\im>%IM%convert rose: -depth 16 -type truecolor r.tiff
F:\web\im>%IM%convert r.tiff -fx "0.5" -unique-colors txt:
# ImageMagick pixel enumeration: 1,1,65535,gray
0,0: (50.0008%,50.0008%,50.0008%) #800080008000 gray(50.0008%)
Perhaps there is something distinctive in your file. If you upload it, someone can take a look.
What version IM are you using? What platform?
Re: -fx fails in one case
Posted: 2014-10-03T16:00:36-07:00
by GreenKoopa
This test shows it too:
Code: Select all
convert in.tif -format "%[mean]\n" info:-
> 28624
convert in.tif -strip -resize 200x200 -format "%[mean]\n" info:-
> 28626.4
convert in.tif -fx "0.5" -format "%[mean]\n" info:-
> 0
convert in.tif -strip -resize 200x200 -fx "0.5" -format "%[mean]\n" info:-
> 0
convert in.tif in2.tif
convert in2.tif -fx "0.5" -format "%[mean]\n" info:-
> 32768
I am on Windows 7.
Re: -fx fails in one case
Posted: 2014-10-03T17:47:44-07:00
by snibgo
Perhaps there is something distinctive in your file. If you upload it, someone can take a look.
What version IM are you using?
Re: -fx fails in one case
Posted: 2014-10-03T19:51:55-07:00
by fmw42
what are you expecting
convert in.tif -fx "0.5" ...
to do? If you want to make the image half as bright, then I believe you want
convert in.tif -fx "u*0.5"
see
http://www.imagemagick.org/script/fx.php
http://www.imagemagick.org/Usage/transform/#fx
Perhaps I misunderstand what you are trying to do?
Re: -fx fails in one case
Posted: 2014-10-03T21:32:17-07:00
by GreenKoopa
I expect a gray image, as demonstrated in the other tests. Of course I want -fx to work for a more complex case, but "0.5" is the most "neutral" operation I could conjure.
An example image:
https://drive.google.com/file/d/0Bxw3ym ... pPNS0zcTA/
Tested using IM 6.8.8-1 and 6.8.9-8 on Windows 7 with several tiffs outputted from Adobe Lightroom 5.5. This happens with any size image, compressed or not, 8 or 16 bit. I think it has something to do with the tiff settings or metadata, but I reached a dead end there. Now I'm just using the workaround I demonstrated for in2.tif earlier.
Re: -fx fails in one case
Posted: 2014-10-04T19:31:05-07:00
by fmw42
Does it fail for other formats, PNG, JPG, GIF, etc? Is it particular to one TIF file or all?
Re: -fx fails in one case
Posted: 2014-10-04T19:45:48-07:00
by fmw42
I can reproduce this in IM 6.8.9.8 Q16 Mac OSX with the image provided.
convert in.tif -fx "0.5" show:
is black, even if I add -strip.
Whereas converted to PNG it comes out properly gray.
convert in.tif in.png
convert in.png -fx "0.5" show:
If I convert other format images to tif, such as png or jpg (24 bit color, just as in the supplied image), it works fine.
So there appears to be something odd about this image. But I opened it in Photoshop CS (very old) and it looks fine. It appears to be just 8-bit per channel RGB with only the one layer. So I am puzzled about why this might be happening.
Re: -fx fails in one case
Posted: 2014-10-04T20:29:19-07:00
by GreenKoopa
The weirdest part is Lightroom tiffs work great in IM. My only problem has been -fx, and I have no hypothesis as to how this could be.
Re: -fx fails in one case
Posted: 2014-10-05T06:22:51-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.9-9 Beta, available by sometime tomorrow. Thanks.