Dear ImageMagick pundits. I am trying to remap the colors of this image
https://drive.google.com/file/d/0B6_zZu ... sp=sharing
Only the colors from this palette can be used
https://drive.google.com/file/d/0B6_zZu ... sp=sharing
For anyone interested, those are colors that one can purchase from the PixelHobby company to create a physical mosaic. I have tried using the free software that is available on their website for this purpose, but the results are poor because some colors (and hence details) are lost in the transition. Also, simply using the -remap operator produces poor results as well. Can anyone offer me a helping hand here if it is not too much trouble?
Help remapping colors
-
- Posts: 3
- Joined: 2013-11-04T10:13:02-07:00
- Authentication code: 6789
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Help remapping colors
This ...
... seems to work. What do you think is wrong? forest.png contains black pixels, but pixels.png doesn't have a black.
Code: Select all
convert forest.gif -remap pixels.png r.png
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help remapping colors
I do not know that you can do better than with -remap in IM.
This is what I get with IM 6.8.7.4 Q16 Mac OSX
This is what I get with IM 6.8.7.4 Q16 Mac OSX
Code: Select all
convert forest.gif +dither -remap pixels.png forest_remap.gif
-
- Posts: 3
- Joined: 2013-11-04T10:13:02-07:00
- Authentication code: 6789
Re: Help remapping colors
What is unsatisfying for me in using the -remap is the details lost in the upper part and in the lower left corner because for both colors of the original image -remap picks the same closest alternative from the pixels.png. I thought maybe there is some clever way of changing the original image a little bit such that -remap would be able to preserve all the details...
Re: Help remapping colors
Add -gamma 1.6 to your command-line.
-
- Posts: 3
- Joined: 2013-11-04T10:13:02-07:00
- Authentication code: 6789
Re: Help remapping colors
Gamma correction reveals the lost details but now -remap shifts blue colors to magenta...
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Help remapping colors
Another way is to note that the darkest colour in pixels.png is about 16%, so we reduce the contrast of the original by lightening it:
Code: Select all
%IM%convert ^
forest.gif ^
+level 16%%,100%% ^
-remap pixels.png ^
r.png
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help remapping colors
Did you put -gamma right after reading the forest image? -gamma 1.6 may be too strong. try reducing it but keep it larger than 1.0mindv0rtex wrote:Gamma correction reveals the lost details but now -remap shifts blue colors to magenta...
Perhaps a more linear adjustment such as user snibgo suggests may work better.