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
Notice the dark line in the middle.
Is there an easy way to fix this?
Color blur
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Color blur
try this
pow 2 = square
pow 0.5 = sqrt
Code: Select all
convert -size 300x300 xc:red xc:green1 +append \
-evaluate pow 2 -blur 0x3 -evaluate pow 0.5 tmp.png
pow 0.5 = sqrt
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Color blur
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.
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.
snibgo's IM pages: im.snibgo.com
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Color blur
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...
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.
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:
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/