fast blur, low gradient?

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
bartleby
Posts: 1
Joined: 2014-06-02T08:33:26-07:00
Authentication code: 6789

fast blur, low gradient?

Post by bartleby »

I have 1000's of image to process, all standard sizes: inputs 2700x2700, output various standard dimensions.

I've been using a gaussian filter on a smale scale image to get a blurred effect that is faster than -blur. However, in the final product there is a significant color gradient or banding.

I have tried dithering, additional blurring and a number of other commands but cannot seem to reduce it in any way.

Are there any alternative approaches I could consider that are still fast but produce less banding?

Input Image = $imagein
Image

Command
convert -units PixelsPerInch $imagein -resize 360X360\> -filter gaussian -resize 50% -define filter:sigma=5.0 -resize 500% -scale 600% -crop 2048x1500+1676+1950 -fill white -colorize 50% -density 72 $imageout

Output image
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: fast blur, low gradient?

Post by fmw42 »

Not sure what you are trying to do. But if all you want is the average color over the whole image, do

Code: Select all

convert image -scale 1x1! -scale WxH! result
where WxH is the dimensions of the original image.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: fast blur, low gradient?

Post by anthony »

Color banding is generally cause by a limits color pallete on a color indexed image file formats.. EG: GIF and PNG8
That is why these images end up using some form of dithering, be it a randomised dither, or ordered dither (which could still use more work).

Color banding should not be visible when using 16 bit RGB images.

Actually just original photos from digital cameras have a fairly strong pixel level dithering. This is especially visible in low light. That is why some photogrphers hate High Mega Pixel cameras, They have lots of pixel producign very high contrasting and sharp photos, but with a stronger pixel level dither patterns for areas of supposedally constant color.

You can see these effects in the enlarged images shown in
http://www.imagemagick.org/Usage/photos/#binning
specifically example sub-pages
http://www.imagemagick.org/Usage/photos ... mple3.html
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: fast blur, low gradient?

Post by snibgo »

Computer displays are usually 8 bits/channel, and banding will often be visible in slowly-changing gradients, eg:

Code: Select all

convert -size 1000x500 gradient:gray(20%)-gray(30%) g.png
16-bit graphics images with such gradients, aimed at viewing on screens, are probably best converted to 8-bit, with dithering.
snibgo's IM pages: im.snibgo.com
Post Reply