remove odd pixels in the image

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
nagarwal
Posts: 13
Joined: 2014-11-24T04:16:09-07:00
Authentication code: 6789

remove odd pixels in the image

Post by nagarwal »

I have a mortar image and it has some blackish pixels on the inside edges.
Image

I need to make those blackish pixels colored same as the grey mortar color.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: remove odd pixels in the image

Post by fmw42 »

try

Code: Select all

convert mn1-bRxR3LFR.png -fuzz 55% -alpha off -fill "rgb(230,230,230)" -opaque "rgb(63,63,63)" -alpha on show:
nagarwal
Posts: 13
Joined: 2014-11-24T04:16:09-07:00
Authentication code: 6789

Re: remove odd pixels in the image

Post by nagarwal »

fmw42 wrote:try

Code: Select all

convert mn1-bRxR3LFR.png -fuzz 55% -alpha off -fill "rgb(230,230,230)" -opaque "rgb(63,63,63)" -alpha on show:

I only needed to change those blackish pixels on inside edges but it changes the images a lot and looses the original texture. the result is

Image
nagarwal
Posts: 13
Joined: 2014-11-24T04:16:09-07:00
Authentication code: 6789

Re: remove odd pixels in the image

Post by nagarwal »

Is there a way to change all pixels with rgb(50,50,50) and less to rgb(230,230,230)? I think that can solve the problem.
nagarwal
Posts: 13
Joined: 2014-11-24T04:16:09-07:00
Authentication code: 6789

Re: remove odd pixels in the image

Post by nagarwal »

nagarwal wrote:
fmw42 wrote:try

Code: Select all

convert mn1-bRxR3LFR.png -fuzz 55% -alpha off -fill "rgb(230,230,230)" -opaque "rgb(63,63,63)" -alpha on show:

I only needed to change those blackish pixels on inside edges but it changes the images a lot and looses the original texture. the result is

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

Re: remove odd pixels in the image

Post by fmw42 »

This is how you would do it.

Code: Select all

convert mn1-bRxR3LFR.png -alpha off -black-threshold 19.6% -fill "gray(230)" -opaque black -alpha on tmp1.png
where 19.6% = 100*(50/255) and gray(230)=rgb(230,230,230). You can increase the black-threshold value, if there are still some dark regions.


If you need to maintain the black in the below transparency region of the base image, then do

Code: Select all

convert mn1-bRxR3LFR.png -alpha off -black-threshold 19.6% -fill "gray(230)" -opaque black -alpha on \
-background black -alpha background tmp1.png


Alternately, you could use a clone stamp tool to modify those dark regions using Photoshop or GIMP
nagarwal
Posts: 13
Joined: 2014-11-24T04:16:09-07:00
Authentication code: 6789

Re: remove odd pixels in the image

Post by nagarwal »

Thanks, you have been a great help!
Post Reply