Page 1 of 1

Remove white pixel

Posted: 2016-03-11T01:43:24-07:00
by v22
Hello,

I need to compare 2 images and find differences between them using IM command line tool.
I am using the following command, to generate a third comparison image with found differences higlighted in white:

Code: Select all

compare image1.jpg image2.jpg -colorspace Gray -fuzz 85% -compose Src -highlight-color White -lowlight-color Black

The problem is the result-comparison image has 'white noise' (or dots bigger than 1 pixel) even in areas where there are no differences between images.
How can I remove these white 'pixel' from my image, leaving text at the bottom left good? .

Here are sample images:

the comparison image (white text at bottom left is a real difference between images):
https://drive.google.com/file/d/0B5SBtm ... sp=sharing


IM version:

ImageMagick 6.8.7-9 Q8 x86
Windows 7 64-bit


Thank you in advance

Re: Remove white pixel

Posted: 2016-03-11T02:35:21-07:00
by snibgo

Re: Remove white pixel

Posted: 2016-03-11T09:34:34-07:00
by v22
updated first post

Re: Remove white pixel

Posted: 2016-03-11T10:02:18-07:00
by fmw42
There must be differences if you get white areas, even if you cannot see them visually. Just a 1 graylevel difference can cause a difference to show.

Also your two images are not the same size. So I am not sure what Imagemagick is comparing.

Perhaps you should upload again and this time show both input images and the corresponding output image.

Re: Remove white pixel

Posted: 2016-03-15T07:47:54-07:00
by v22
How can you say I am comparing different size images If I didn't upload them?

The images I uploaded in my post are:
- the comparison image
- a zoomed-in portion of the comparison image (just to let you see the white pixel I am talking about)

The images I am comparing have instead the same size and I cannot upload them.
I suppose the 'white pixel' difference I see is a difference caused by 'lossy/artifact' nature of JPG.


My question is if I can remove white pixel from an image using IM command line (so AFTER comparing my images), not if I can get a perfect comparison image.

Re: Remove white pixel

Posted: 2016-03-15T08:01:29-07:00
by snibgo
You have uploaded two images. Neither has any white pixels.

Re: Remove white pixel

Posted: 2016-03-15T09:18:38-07:00
by v22
The second image has something like a 'noise', white pixel/area on a black background
can't you see it?

Re: Remove white pixel

Posted: 2016-03-15T09:38:06-07:00
by snibgo
whitePixel.jpg is greyscale, and the lightest pixel is 206 in a scale of 0 to 255.

I don't understand what you want. You can turn all the pixels black using (eg by "+opaque"). Or you could turn the white pixels black, but there aren't any. Or all the pixels within a given fuzz factor near white.

I don't think you want to "remove" pixels. Perhaps you want to change their colour, or make them transparent, or something.

Re: Remove white pixel

Posted: 2016-03-15T09:51:25-07:00
by fmw42
How can you say I am comparing different size images If I didn't upload them?
That is the problem. You did not upload your two input images for us to examine. So how can we tell you how to fix the issue if we cannot test ourselves.

Re: Remove white pixel

Posted: 2016-03-15T10:03:00-07:00
by v22
Ok, sorry my question was not clear and I've uploaded the wrong files.

I cannot upload the images I am comparing, but they are not the point since I am not interested in new method to compare images but on a method to modify the comparison image.


Here is the correct comparison image on which I am working on:
https://drive.google.com/file/d/0B5SBtm ... sp=sharing

I would like to remove 'noise' from that image: if you zoom in, you can see 'white pixel/small white' areas.
With 'remove noise' I mean turn 'white pixel' into black (the same color of background), but without removing white text at bottom left.

I tried using -median 3 command, this is the result :
https://drive.google.com/file/d/0B5SBtm ... sp=sharing

The new image has no 'noise' but text is a bit degraded, is there a better way to remove noise leaving text in the original form?

Re: Remove white pixel

Posted: 2016-03-18T03:09:37-07:00
by v22
With "-median 3" I am able to remove 'white pixel', and result with text is acceptable.

I have now another problem, I would like to remove also vertical and horizontal with lines (to remove I mean turn into background color).
An example of vertical line I would like to remove:
https://drive.google.com/file/d/0B5SBtm ... sp=sharing

Any suggetions?