Page 1 of 1

Color blur

Posted: 2016-12-01T09:27:20-07:00
by dognose
I was just watching this video on how broken color blur is
https://www.youtube.com/watch?v=LKnqECcg6Gw

and noticed the same problem with IM -blur and -gaussian-blur

Image

Notice the dark line in the middle.

Is there an easy way to fix this?

Re: Color blur

Posted: 2016-12-01T10:34:24-07:00
by fmw42
try this

Code: Select all

convert -size 300x300 xc:red xc:green1 +append \
-evaluate pow 2 -blur 0x3 -evaluate pow 0.5 tmp.png
pow 2 = square

pow 0.5 = sqrt

Re: Color blur

Posted: 2016-12-01T10:59:36-07:00
by snibgo
It isn't "wrong", but just the way it works.

The perceived dark band occurs when we blur (or anti-alias, etc) in sRGB, or other non-linear colorspace. If we don't want this, then convert to linear colorspace before blurring, and back to non-linear afterwards.

If the image is encoded in sRGB, then use "-colorspace RGB" and "-colorspace sRGB". Or as the video says inaccurately, square and square-root. Or, better, use 2.2 and 0.454545.

Re: Color blur

Posted: 2016-12-08T22:41:47-07:00
by anthony
It is also because the blur blurs red areas into black, and green areas into black because they are seperate color channels!
Try doing the blur in a different (also more linear) colorspace. Perhaps LAB or LUV colorspace.

Though snibgo is right in that the non-linear colors of sRGB is probably the main culpret

Hmmm...

Code: Select all

convert -size 50x50 xc:red xc:green1 +append -blur 0x30 show:
convert -size 50x50 xc:red xc:green1 +append -colorspace RGB -blur 0x30 -colorspace sRGB show:
convert -size 50x50 xc:red xc:green1 +append -colorspace LAB -blur 0x30 -colorspace sRGB show:
convert -size 50x50 xc:red xc:green1 +append -colorspace LUV -blur 0x30 -colorspace sRGB show:
The first shows the 'black' band. The other three (linear colorspace blurs) show basically identical, 'orange' bands.

This may be the best example yet on why image processing in sRGB is a bad idea.

Added the above into
http://www.imagemagick.org/Usage/color_ ... processing

UPDATE: The linked examples has now been formatted with example image results.