Page 1 of 1

Thumbnail problem wth Flat images

Posted: 2009-09-09T07:01:02-07:00
by sanjeevk
Hi ,
We are trying to create a thumbnail of a flat image which has only 4 colors and when we generate a thumbnail of that image they are enhanced by many colors . We want to retain the original colors only.

Can someone please let us know how to do retain the colors of the original image.

Commands I have done
1. convert BMPfile.bmp -strip PNGFile.png
2. convert PNGFile.png -matte \( +clone -fuzz 15% -transparent \ #0000FF \) -compose dst-out -composite PNGFile_Color1.png
We repeat step 2 to get all the 4 colors.(Even fuzz can be removed I suppose).and then run the following for all 4 images(we have segrgated all 4 colors of the image by this)
3. convert PNGFile_Color1.png -thumbnail 325x450 -quality 100 -strip -coalesce -gravity center -background white -extent 325x450 -strip PNGFile_Color1_Thumb.png
This thumbnail generated now has more than one color for flat files also.

Can someone please help.

Here are the images.
Image
Image
Image
Image

Re: Thumbnail problem wth Flat images

Posted: 2009-09-09T09:37:02-07:00
by fmw42
-resize and -thumbnail resample/interpolate the colors between pixels when changing sizes; that is they do a special blending of the pixels in the neighborhood of the exact fractional coordinate needed from the input to correspond to the pixel in the output

try adding -filter point before -thumbnail

see
http://www.imagemagick.org/Usage/resize/#filter

Re: Thumbnail problem wth Flat images

Posted: 2009-09-09T21:40:54-07:00
by anthony
Using -filter point for -resize or -thumbnail is the same as using the much faster dedicated operator -sample

Re: Thumbnail problem wth Flat images

Posted: 2009-09-10T09:41:09-07:00
by fmw42
with -sample, you would need to add -strip to get the same effects as with -thumbnail to remove the profiles