Page 1 of 1
how to smooth image
Posted: 2012-08-18T08:27:17-07:00
by VanGog
Hi,
do you know some trick how to smooth this?
http://i50.tinypic.com/110ke9i.png
it is just resulting image, not the source. Source is 8bit RGB, half size of the result, but better quality. But when I enlarge the image 2x it is blured. I then sharpen the image in Photoshop and paste it into 256 index color document...
The resulting image is for bmp with 256 colors. It is image for game. Game graphics need simplified areas of color. If I take normal image and resize it, sometimes it has this ugly pixels. It is because on the walls black or orange is changed often. The results is that pixels of various color are there, and the result is not nice. I would need to simplify the areas of similar color. Is that possible? Yet you can see there are red pixel that should not be there.
I can use the original, so maybe image magick could work with it, and prepare the image - to smooth the areas which are similar color. My next step (which I do in Photoshop) will be to paste that image into empty image with 256 indexed colors. Maybe you have some function which could detects the nearest color from the image palette and then to smooth the areas which are similar to that color.
PS: When I write "simplify" and "smooth" I mean to convert the image, like it would be drawing or clipart. Something similar.
Re: how to smooth image
Posted: 2012-08-18T17:15:36-07:00
by fmw42
try this
convert 110ke9i.png -background black -alpha background \
\( -clone 0 -alpha off -median 7x7 \) \
\( -clone 0 -alpha extract \) \
-delete 0 -alpha off -compose copy_opacity -composite 110ke9i_new.png
What version of IM are you using? What platform? You should always supply that.
The above is for unix. If on windows remove the \ escape before the parens and replace the \ at the end of lines with ^
See
http://www.imagemagick.org/Usage/windows/
Re: how to smooth image
Posted: 2012-08-19T02:32:31-07:00
by VanGog
Sorry, but this is same result. Don't forget I will turn to index color in the palette of the image I sent you before. The Colorado are blured and mixed together. Try how it will look with 256 colors only.
Here is new image screenshot from photoshop
http://i46.tinypic.com/214a8pc.png
This is not that result I want, but it has something to demonstrate. The new demonstration image is not so exact, because many of the details are lost. It looks like drawing with a brush. You should note that the
areas with same color are wider. I know, if you zoom in into details, you see the areas which seem same color are not same color too. Same problem. But you understand the goal. I need to connect that pixels into one color areas (not so big size).
That is what I would like to have. But not like Photoshop - I need the areas are less size, because otherwise the details are lost. This demonstration image of mine is unusable now because I would need to resize it to 124x81 px, with is very little size (not good for me).
PS: I am WIndows user
Version: ImageMagick 6.7.7-0 2012-05-17 Q16
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
PS: I have found some recommendation for program called Inkscape, that it can convert raster into vectors and create image look like clipart, so I will probably try. Maybe it could help.
Re: how to smooth image
Posted: 2012-08-19T07:57:37-07:00
by VanGog
Well, in the Inkscape there is filter called Morphology/Erode (I used radius 1,8 - 2,8) and it does wonderful job! You can downloadit as OpenSource and try.
Filters->Filter Editor->New->Morphology->add->now set your params Erode, and your radius.
I could upload my image because I had to correct some problems on it, after corrections it would work.
Re: how to smooth image
Posted: 2012-08-19T11:42:14-07:00
by fmw42
IM has -morphology erode. It also works on color images
see
http://www.imagemagick.org/Usage/morphology/#erode
Re: how to smooth image
Posted: 2012-08-19T15:39:02-07:00
by VanGog
Is it possible to use octagon with decimal numbel? Loocs does not work:
convert chateau.png -morphology Erode Octagon:1.2 Octagon_1.2.png
Only Octagon:1 which is too little radius and Octagon:2, which is too big radius.
Any other smoothing techniques? This one is not good because it leaves "circles" like brush strokes on the picture. I would need more sophisticated method. For example to detect the colors with "circles" first, and then to detect the area which has same color and then to applicate the effect. -morphology Erode looks like it does not try to detect the area, it just draws the "circle".
Re: how to smooth image
Posted: 2012-08-19T16:22:02-07:00
by fmw42
Octagon only uses integers for the radius of the shape. Try other shapes such as square or diamond. Those should give intermediate results. However, I suspect you want something else that IM cannot do.
You can also try changing my median 7x7 earlier with -statistic mode 7x7. See if that is more what you want.
Re: how to smooth image
Posted: 2012-08-20T02:41:19-07:00
by VanGog
fmw42 wrote:You can also try changing my median 7x7 earlier with -statistic mode 7x7.
What do you speak about?
Re: how to smooth image
Posted: 2012-08-20T09:49:20-07:00
by fmw42
VanGog wrote:fmw42 wrote:You can also try changing my median 7x7 earlier with -statistic mode 7x7.
What do you speak about?
convert 110ke9i.png -background black -alpha background \
\( -clone 0 -alpha off
-statistic mode 7x7 \) \
\( -clone 0 -alpha extract \) \
-delete 0 -alpha off -compose copy_opacity -composite 110ke9i_new.png
Re: how to smooth image
Posted: 2012-08-20T13:41:24-07:00
by VanGog
I don't know, what I do have wrong in my Windows syntax?
Code: Select all
convert chateau.png -background black -alpha background ^
( -clone 0 -alpha off -statistic mode ) ^
( -clone 0 -alpha extract ) ^
-delete 0 -alpha off -compose copy_opacity -composite static_chateau.png
Not valied argument - -background
Re: how to smooth image
Posted: 2012-08-20T14:51:51-07:00
by fmw42
VanGog wrote:I don't know, what I do have wrong in my Windows syntax?
Code: Select all
convert chateau.png -background black -alpha background ^
( -clone 0 -alpha off -statistic mode ) ^
( -clone 0 -alpha extract ) ^
-delete 0 -alpha off -compose copy_opacity -composite static_chateau.png
Not valied argument - -background
Sorry when cutting a pasting I accidentally remove the 7x7 size or whatever size you want.
Try
convert chateau.png -background black -alpha background ^
( -clone 0 -alpha off -statistic mode
7x7 ) ^
( -clone 0 -alpha extract ) ^
-delete 0 -alpha off -compose copy_opacity -composite static_chateau.png
Re: how to smooth image
Posted: 2012-08-21T01:08:14-07:00
by VanGog
I'm not sure from which system I had run the command. I will test it later on different system.
Re: how to smooth image
Posted: 2012-08-23T10:19:55-07:00
by VanGog
Thanks a lot for those command. It's amazing. Much more better then those previous. I applied it on original sized image and then I did resize
New version of the castle (original size):
http://i45.tinypic.com/20kp114.png
Resized version with different palette:
http://i45.tinypic.com/4kuwit.jpg
Re: how to smooth image
Posted: 2012-08-23T16:43:51-07:00
by pipitas
If you put 'img' tags around your image URLs like this:
we could see them directly in this forum and wouldn't need to open new tabs to go and look there...

See for yourself:
VanGog wrote:New version of the castle (original size):

Resized version with different palette:

Re: how to smooth image
Posted: 2012-09-15T09:52:03-07:00
by VanGog
I dont like img tag for those big images, because I dont see it whole. This is better to view.