Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm not sure how to remove the paper background from this logo with v9.

enter image description here

This is really not the same as this question, but I think similar methods apply.

share|improve this question
up vote 14 down vote accepted

Not as classy as @belisarius', but:

i1 = Import@""
ColorReplace[i1, RGBColor@PixelValue[i1, {2, 2}], .02]



Perhaps it would be better would be to use Vitaliy's method, illustrated in this excellent answer. In this version, the image has a white background, not transparent (hence the difference in color, I suppose):

data = ImageData[i1];
Image[data /. {x_, y_, z_} /; 
    EuclideanDistance[{x, y, z}, data[[2, 2]]] < .3 -> {1, 1, 1}]


The value of .3 is taken from looking at a ListPlot of the EuclideanDistance values.

share|improve this answer
Hehe ... It's not a "classyness" problem. I don't have v9 :) – Dr. belisarius Jan 21 '13 at 11:53

It's actually easier than your linked question, since your ROI is monochromatic!

i1 = Import@""
i2 = Image[ImageData[
   ImageMultiply[Binarize[ColorSeparate[i1, "HSB"][[1]]], i1]] /. {0., 0., 0.} -> {1, 1, 1}]

Mathematica graphics


If you want a fully saturated image, you could do something like

pmax = Position[ImageData[ColorSeparate[i1, "HSB"][[2]]], 1.][[1]]
Image@Replace[#, Except[{1., 1., 1.}] -> Extract[#, pmax], {2}] &@ ImageData[i2]

Mathematica graphics

share|improve this answer
Nice answer (although kind of brevity is the soul of wit ;) ). @M.R if you eventually want to turn the white background (what the verb "remove" implies; at least to me) to transparent please read this contribution of Szabolcs implementing a reverse blend.… – Stefan Jan 21 '13 at 7:37

In version 10 there is now a RemoveBackground function, with more options and parameters than you could dream of. Without any help, it will do this:

i1 = Import@"";

simple remove background

but with some encouragement, in the form of a hint about the background's colour, or some marker positions to indicate the background, it can do even better:

RemoveBackground[i1, {"Background",  {RGBColor[0.9, 0.9, .7], .1}}]

better remove background

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.