Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

3 Answers 3

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@"http://i.stack.imgur.com/LKZfw.png";
RemoveBackground[i1]

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

Not as classy as @belisarius', but:

i1 = Import@"http://i.stack.imgur.com/LKZfw.png"
ColorReplace[i1, RGBColor@PixelValue[i1, {2, 2}], .02]

logo

Edit:

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}]

logo2

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 :) –  belisarius Jan 21 '13 at 11:53

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

i1 = Import@"http://i.stack.imgur.com/LKZfw.png"
i2 = Image[ImageData[
   ImageMultiply[Binarize[ColorSeparate[i1, "HSB"][[1]]], i1]] /. {0., 0., 0.} -> {1, 1, 1}]

Mathematica graphics

Edit

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
1  
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. stackoverflow.com/questions/8041703/… –  Stefan Jan 21 '13 at 7:37

Your Answer

 
discard

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.