>compare confuses me anyway, why does the order of the 2 images to compare
>matter?
>
>Still on the 2 icons I referenced earlier, the last commands I was trying
>were:
>
>compare -channel RGBA -alpha on -metric ae crushed.png original.png /dev/null
>2 <- I expect 0 here, why is it 2?
>
>compare -channel RGBA -alpha on -metric ae original.png crushed.png /dev/null
>98     <- wtf?
>
>
>compare -channel RGBA -alpha set -metric ae crushed.png original.png /dev/null
>0
>compare -channel RGBA -alpha set -metric ae original.png crushed.png /dev/null
>0


Here are some issues that I found from testing your images 
external.png and external-crushed.png:

First, if you turn off the alpha channel that exist in the first 
image and not the second, it works fine:

compare -metric rmse -alpha off external.png external-crushed.png null:
0 (0)


Second, when you do:

compare -metric rmse -channel rgba -alpha on external.png 
external-crushed.png null:
19335.6 (0.295042)

You don't get zero. Here is why (I think). The alpha channels are not the same.

I tried forcing on the alpha channel on external-crushed.png before 
running compare:

convert external-crushed.png -alpha on external-crushed_aon.png

Then
compare -metric rmse external.png external-crushed_aon.png null:
327.612 (0.00499904)

or
compare -metric rmse -channel rgba external.png external-crushed_aon.png null:
327.612 (0.00499904)

or
compare -metric rmse -channel rgba -alpha on external.png 
external-crushed_aon.png null:
327.612 (0.00499904)



So I took a look at the verbose info for both images:

identify -verbose external.png
...
  Type: PaletteMatte
  ...
    alpha:
       min: 255 (1)
       max: 255 (1)
       mean: 255 (1)
       standard deviation: -0 (-0)
       kurtosis: 0
       skewness: 0


identify -verbose external-crushed_aon.png
...
  Type: PaletteMatte
  ...
    alpha:
       min: 252 (0.988235)
       max: 255 (1)
       mean: 255 (1)
       standard deviation: -0 (-0)
       kurtosis: 0
       skewness: 0



The first is totally opaque and the second is almost totally opaque, 
but its min is 252 and not 255.

Why does this happen.  If a png has an alpha channel already, but it 
is turned off. Then -alpha on, just turns it back on as it was. If it 
did not already have an alpha channel then it is forced to be on and 
opaque.

Here is my issue. I should be able to force the image to have a 
totally opaque alpha channel by doing

convert external-crushed.png -channel rgba -alpha opaque 
external-crushed_aop.png

or

convert external-crushed.png -alpha off -alpha set external-crushed_aset.png


then

identify -verbose should show a fully opaque alpha channel, but it 
does not. It shows no alpha channel. I am not sure but it seems like 
a bug:

identify -verbose external-crushed_aop.png
or
identify -verbose external-crushed_aset.png


...
Type: Palette
...
No alpha channel stats.


So to really force the alpha channel to opaque, I did the following 
to strip the alpha channel (even if off) and then make an opaque one:

convert external-crushed.png -channel rgb -separate -combine -alpha 
opaque external-crushed_aopq.png

identify -verbose external-crushed_aopq.png
...
  Type: PaletteMatte
  ...
    alpha:
       min: 255 (1)
       max: 255 (1)
       mean: 255 (1)
       standard deviation: -0 (-0)
       kurtosis: 0
       skewness: 0


So now do the compare:

compare -metric rmse external.png external-crushed_aopq.png null:
0 (0)


So now it works with both images having the same alpha channel.


Fred








_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users
  • ... Timothee Groleau
    • ... da . mihi . sis . bubulae . frustrum . assae . solana . tuberosa . in . modo . gallico . fricta . ac . quassum . lactatum . coagulatum . crassum
      • ... Timothee Groleau
    • ... Fred Weinhaus
      • ... Timothee Groleau
    • ... Fred Weinhaus
    • ... Fred Weinhaus

Reply via email to