Page 1 of 1
Create a MultiColor Image
Posted: 2011-05-19T02:52:22-07:00
by lilith
Hello,
I want to create a multicolored image as
http://www.imagemagick.org/Usage/canvas ... lormap.jpg
I tried many commands, but not successfully
My goal is to have maximum of uniques colors in the smallest possible definition.
For example, i would have a 300x300 images with 90000 colors.
It's for a PNG filtering demonstration.
Thanks in advance !
Re: Create a MultiColor Image
Posted: 2011-05-19T10:06:04-07:00
by fmw42
Re: Create a MultiColor Image
Posted: 2011-05-19T17:36:12-07:00
by anthony
There are actually many ways to do this, some slow, some not so slow.
Most are listed in the Gradient Canvas area of IM examples, including the sparse color methods suggested.
http://www.imagemagick.org/Usage/canvas/#gradient
Another technique (very slow) is the use of FX to interpolate a small image, and is show in
http://www.imagemagick.org/Usage/misc/#interpolate
A variation on this (not shown on the page) is to use a two point affine distortion (distorting using the middle of pixels
Code: Select all
convert \( xc:red xc:blue +append \) \
\( xc:yellow xc:cyan +append \) -append \
-filter point -interpolate bilinear -define distort:viewport=100x100 \
-distort Affine '.5,.5 .5,.5 1.5,1.5 99.5,99.5' interpolate_bilinear.jpg
That is equivalent to the FX method and is faster but as you can see needs some setup.
Re: Create a MultiColor Image
Posted: 2011-05-20T00:09:46-07:00
by lilith
I've already tested that before posting. The proposed codes do not work for me, syntax seems to be incorrect. I'm running under Windows, with the lastest version.
Maybe i do not know how to use it. I'm a IM noob user, but if i copy your codes to a batch file, it just does not work.
For example :
Code: Select all
convert -size 30x600 xc:'#0F0' -colorspace HSB \
gradient: -compose CopyRed -composite \
-colorspace RGB -rotate 90 gradient_rainbow.jpg
To run that, I've to modify it to :
Code: Select all
convert -size 30x600 xc:#0F0 -colorspace HSB gradient: -compose CopyRed -composite -colorspace RGB -rotate 90 gradient_rainbow.jpg
This is the only manipulation i've successfully done ! I tried to modify others, but it failed.
Thanks in advance.
Re: Create a MultiColor Image
Posted: 2011-05-20T00:14:39-07:00
by anthony
For conversion of UNIX type commands to DOS see...
http://www.imagemagick.org/Usage/windows/#dos
Re: Create a MultiColor Image
Posted: 2011-05-20T09:34:29-07:00
by fmw42
See the link Anthony posted. But 3 issues are common
1) line continuations in Windows is ^ and not \
2) replace single quotes with double quotes
3) do not escape parens with \, no escape is needed
Re: Create a MultiColor Image
Posted: 2011-05-29T21:34:26-07:00
by anthony
This discussion was continued but for a completely different topic or point.
All the posts involved has been split into a new topic in "Digital Image Processing"
with a topic name of "Resize using center of pixel (not edge)"
viewtopic.php?f=22&t=18846