HOW TO - FIND THE REGIONS OF LEAST/MOST DIFFERENCE

INGREDIENTS

  1. One original layer

FORMULA

  1. Duplicate the original layer
  2. Use 'selective gaussian blur' on the new layer
  3. Set the layer to difference mode
  4. Copy visible
  5. Paste onto the new layer and anchor.
  6. Threshold to (GUESS 16)..255
  7. Invert (the new layer now contains a mask of all the pixels that are NOT different from neighbours)

    ~~~~

USAGE

TRIAL:

DiffMaskDifference mask.
DiffMaskSmoothVectorsmoothed difference mask.
AutoAAedAutomatically AAed using my vectorscaler. This is the filtered version that will be masked.
CombinedAutoAAed masked by DiffMask.
CombSmoothAutoAAed masked by DiffMaskSmooth.
CombIndxCombined indexized to the original palette
CombSmoothIndxCombSmooth indexized to the original palette

PRESETS:

SituationSelective Gaussian Blur options
PhotoRADIUS 5, THRESHOLD 70
PixelartRADIUS 3, THRESHOLD 50 (used for DiffMask)

PLUGIN: selectdiffs.py

CODE



import newvector as nv

def perLayer(image, layer, blur_radius = 3, blur_delta = 50, threshold = 16, invert = False, smooth=False):

"'Smart' Auto-antialiasing. Leaves highresolution detail alone." newlayer = pdb.gimp_layer_copy (layer,False) # need to add it to image here?
pdb.plug_in_sel_gauss (image, newlayer, blur_radius, blur_delta) newlayer.mode = DIFFERENCE_MODE
#need to flush displays here?
buf = pdb.gimp_edit_named_copy_visible (image,'temp') fsel = pdb.gimp_edit_named_paste (newlayer,buf,False) pdb.gimp_floating_sel_anchor(fsel)
pdb.gimp_threshold(newlayer, threshold, 255) if invert:

pdb.gimp_invert(newlayer)
if smooth:

        # do something I haven't decided yet with pdb.plug_in_smooth_selection(image, newlayer) here
        pass

#Add a layer mask and chuck the layer content across mask = pdb.gimp_layer_create_mask (newlayer, ADD_COPY_MASK) pdb.gimp_layer_add_mask(newlayer,mask) return newlayer




  

FURTHERING

RELATIVES