Thumbnail problem wth Flat images

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
sanjeevk
Posts: 26
Joined: 2009-08-26T02:17:36-07:00
Authentication code: 8675309
Location: India
Contact:

Thumbnail problem wth Flat images

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Thumbnail problem wth Flat images

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Thumbnail problem wth Flat images

Post by anthony »

Using -filter point for -resize or -thumbnail is the same as using the much faster dedicated operator -sample
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Thumbnail problem wth Flat images

Post by fmw42 »

with -sample, you would need to add -strip to get the same effects as with -thumbnail to remove the profiles
Post Reply