Fred,

On Sep 22, 2009, at 9:08 PM, Fred Weinhaus wrote:

> Your image is already 64x64 pixels. So why are your doing a -resize  
> to the same size?
>
> Please clarify. This makes no sense to me.
>


Eventually i want to resize that image. My intention in using the  
exact same size as the original one was to show that
the resulting image was different than the original one after a resize  
with the exact same dimension. It is different
i) in terms of size, it is much bigger
ii) in terms of rendering (it displays differently on IE6)

 From looking at the verbose output for display, the only major  
difference i can see is that the 'Background' goes from
'white' to 'rgba(1,1,1,1)'. But yet, i don't really know what  
'Background' refers to, because as you pointed out,
my original image is transparent and i would like to keep it that way.



> Do you need to keep the transparency?


Yes. I want the resulting image to be exactly the same as the original  
one-- except for the resize parameters. Again, i used,
the same dimension with the intention of showing that what we expect  
to be a no-operation result in a different image.

>
> -flatten needs a background color, but then the transparency will go  
> away and become the background color in its place. But then your  
> white will not have any transparency. So this may not be what you  
> want as you lose transparency (and the file size still gets doubled)
>
> I am still confused.
>
> From your histogram in identify -verbose wbtest.png, your background  
> is transparent black  rgb(0,0,0,0) or none and all other colors are  
> opaque rgb(x,y,z,1). so you have no pure white at rgb(255,255,255)  
> without having an opaque setting of 1. Whenever you have any  
> transparency all opaque colors get 1 for the alpha channel. So you  
> will have four channels, red, green, blue and alpha. This is true in  
> your original image. It is not white as rgb(255,255,255) but  
> rgb(255,255,255,1). To get rid of the alpha channel you have to turn  
> it off which will make the background black or flatten it to some  
> background color which can be white if you want
>
> convert wbtest.png -background white -flatten -depth 8 wbtest_tmp2.png
>
> <wbtest_tmp2.png>
>
>
> I leave off the -resize as it will not change the size of the image  
> as it is already 64x64, so resize only confuses things.
>
> I also note that your input image has a compression of zip. The  
> output does also, but the compression amount may be different. You  
> can try -compress and see if that helps, but my experiments were  
> inconsistent.
>
> For any processing, IM will read the image, decompress if compressed  
> and then process and recompress, possibly with a different amount OR  
> compression algorithm. This could explain the difference in file size.
>
> At this point, I have not been able to preserve your original image  
> size. IM seems to approx double it even if I do
>
> convert wbtest.png -depth 8 -quality 0 -compress zip wbtest_tmp6.png
>

 > convert ./wbtest.png -depth 8 -quality 0 -compress zip result.png
 > ls -l wbtest.png result.png
-rw-r--r--  1 stephane  staff  1538 Sep 23 09:57 result.png
-rw-r--r--@ 1 stephane  staff   661 Sep 22 13:41 wbtest.png


The compression does not seem to help much.


Thanks,

S.




> Fred
>
>
>> Fred,
>>
>> What i want is basically having a 'no-operation' after i do a  
>> resize using the same original dimension.
>> So, in the case of my image, the background is transparent and the  
>> size is 661 bytes and so i would like
>> that to stay the same.
>>
>> When i do the operation:
>> > convert wbtest.png -resize 64x64 result.png
>>
>> i get a bigger image and i can see from doing a  'identify - 
>> verbose' that the  'Background' goes from 'white' to rgba(1,1,1,1).
>> In most browser the resulting image display identically except in  
>> IE6 (of course!), and so that theoretically same resulting
>> image is actually different.
>>
>> In terms of the size, i tried applying the argument '-flatten' and  
>> '-depth 8', but the resulting image is still much bigger:
>>
>> > convert  wbtest.png  -flatten -depth 8 -resize 64x64 result.png
>> > ls -l wbtest.png result.png
>> -rw-r--r--  1 stephane  staff  1498 Sep 22 20:18 result.png
>> -rw-r--r--@ 1 stephane  staff   661 Sep 22 13:41 wbtest.png
>>
>> I attached the image.
>>
>> Thanks a lot for your help and recommendation. I am pretty ignorant  
>> in this field so maybe i a missing the obvious.
>>
>> S.
>>
>> Attachment converted: Macintosh HD:wbtest.png (PNGf/«IC») (00A1F4E3)
>>
>>
>>
>>
>> On Sep 22, 2009, at 6:00 PM, Fred Weinhaus wrote:
>>> Stephane,
>>>
>>> You have fully transparent black and opaque ever other color in  
>>> your histogram.
>>>
>>> So you can flatten the image before resizing. Your image is 8-bit,  
>>> but if you are on a Q16 IM, then if you want a smaller result, you  
>>> can add -depth 8. So
>>>
>>> convert  wbtestt.png -background black  -flatten -depth 8 -resize  
>>> 64x64 result.png
>>>
>>> See if that does what you want? Otherwise send me your image and  
>>> let me see what is going on.
>>>
>>> The reason you may be getting other results is that you have a  
>>> binary alpha channel, but resize may be interpolating/resampling  
>>> that so that at the edges of the white/black boundary in the  
>>> overlay, you are getting values between 0 and 1. To avoid this,  
>>> you can either set -filter point or use -sample in place of -resize.
>>>
>>> Fred
>>>
>>>> Fred,
>>>>
>>>> The verbose output for my image is below. From what i know of  
>>>> this image is that it is a '1 bit transparency image'.
>>>> But still i don't understand why the resize transformation  
>>>> changes other parameters than the size.
>>>>
>>>> Also i noticed that after the transformation (a resize with the  
>>>> exact same dimension as the orginal one), the image is
>>>> much larger:
>>>>
>>>> > convert wbtest.png -resize 64x64 wbtestt.png
>>>>>
>>>>> ls -l wbtest.png wbtestt.png
>>>> -rw-r--r--@ 1 stephane  staff   661 Sep 22 13:41 wbtest.png
>>>> -rw-r--r--@ 1 stephane  staff  1520 Sep 22 17:43 wbtestt.png
>>>>> identify -verbose wbtest.png
>>>>
>>>> Image: wbtest.png
>>>>  Format: PNG (Portable Network Graphics)
>>>>  Class: DirectClass
>>>>  Geometry: 64x64+0+0
>>>>  Resolution: 72x72
>>>>  Print size: 0.888889x0.888889
>>>>  Units: Undefined
>>>>  Type: PaletteMatte
>>>>  Endianess: Undefined
>>>>  Colorspace: RGB
>>>>  Depth: 8-bit
>>>>  Channel depth:
>>>>    red: 8-bit
>>>>    green: 8-bit
>>>>    blue: 8-bit
>>>>    alpha: 1-bit
>>>>  Channel statistics:
>>>>    red:
>>>>      min: 0 (0)
>>>>      max: 255 (1)
>>>>      mean: 72.2864 (0.283476)
>>>>      standard deviation: 114.324 (0.448329)
>>>>      kurtosis: -1.08971
>>>>      skewness: 0.951705
>>>>    green:
>>>>      min: 0 (0)
>>>>      max: 202 (0.792157)
>>>>      mean: 57.261 (0.224553)
>>>>      standard deviation: 90.5602 (0.355138)
>>>>      kurtosis: -1.08976
>>>>      skewness: 0.951685
>>>>    blue:
>>>>      min: 0 (0)
>>>>      max: 222 (0.870588)
>>>>      mean: 62.9297 (0.246783)
>>>>      standard deviation: 99.5258 (0.390297)
>>>>      kurtosis: -1.0897
>>>>      skewness: 0.951706
>>>>    alpha:
>>>>      min: 0 (0)
>>>>      max: 255 (1)
>>>>      mean: 72.9016 (0.285889)
>>>>      standard deviation: 115.218 (0.451837)
>>>>      kurtosis: -1.10179
>>>>      skewness: -0.947738
>>>>  Image statistics:
>>>>    OverAll:
>>>>      min: 0 (0)
>>>>      max: 255 (1)
>>>>      mean: 93.6439 (0.367231)
>>>>      standard deviation: 117.259 (0.459841)
>>>>      kurtosis: -1.71931
>>>>      skewness: 0.48071
>>>>  Alpha: none   #00000000
>>>>  Histogram:
>>>>      2925: (  0,  0,  0,  0) #00000000 none
>>>>       974: (255,202,222,255) #FFCADE rgba(255,202,222,1)
>>>>        27: (254,201,221,255) #FEC9DD rgba(254,201,221,1)
>>>>        24: (253,200,220,255) #FDC8DC rgba(253,200,220,1)
>>>>        20: (252,200,219,255) #FCC8DB rgba(252,200,219,1)
>>>>        13: (251,199,219,255) #FBC7DB rgba(251,199,219,1)
>>>>         8: (249,197,217,255) #F9C5D9 rgba(249,197,217,1)
>>>>         7: (250,198,218,255) #FAC6DA rgba(250,198,218,1)
>>>>         6: (244,193,212,255) #F4C1D4 rgba(244,193,212,1)
>>>>         6: (248,196,216,255) #F8C4D8 rgba(248,196,216,1)
>>>>         4: (216,171,188,255) #D8ABBC rgba(216,171,188,1)
>>>>         4: (237,188,206,255) #EDBCCE rgba(237,188,206,1)
>>>>         4: (238,189,207,255) #EEBDCF rgba(238,189,207,1)
>>>>         4: (240,190,209,255) #F0BED1 rgba(240,190,209,1)
>>>>         3: (214,170,186,255) #D6AABA rgba(214,170,186,1)
>>>>         3: (223,177,194,255) #DFB1C2 rgba(223,177,194,1)
>>>>         3: (232,184,202,255) #E8B8CA rgba(232,184,202,1)
>>>>         3: (235,186,205,255) #EBBACD rgba(235,186,205,1)
>>>>         3: (239,189,208,255) #EFBDD0 rgba(239,189,208,1)
>>>>         3: (241,191,210,255) #F1BFD2 rgba(241,191,210,1)
>>>>         3: (243,192,212,255) #F3C0D4 rgba(243,192,212,1)
>>>>         3: (245,194,213,255) #F5C2D5 rgba(245,194,213,1)
>>>>         3: (246,195,214,255) #F6C3D6 rgba(246,195,214,1)
>>>>         3: (247,196,215,255) #F7C4D7 rgba(247,196,215,1)
>>>>         2: (213,169,185,255) #D5A9B9 rgba(213,169,185,1)
>>>>         2: (217,172,189,255) #D9ACBD rgba(217,172,189,1)
>>>>         2: (219,173,191,255) #DBADBF rgba(219,173,191,1)
>>>>         2: (220,174,192,255) #DCAEC0 rgba(220,174,192,1)
>>>>         2: (222,176,193,255) #DEB0C1 rgba(222,176,193,1)
>>>>         2: (233,185,203,255) #E9B9CB rgba(233,185,203,1)
>>>>         2: (234,185,204,255) #EAB9CC rgba(234,185,204,1)
>>>>         2: (236,187,205,255) #ECBBCD rgba(236,187,205,1)
>>>>         2: (252,200,220,255) #FCC8DC rgba(252,200,220,1)
>>>>         1: (141,112,123,255) #8D707B rgba(141,112,123,1)
>>>>         1: (188,150,164,255) #BC96A4 rgba(188,150,164,1)
>>>>         1: (201,159,175,255) #C99FAF rgba(201,159,175,1)
>>>>         1: (203,161,177,255) #CBA1B1 rgba(203,161,177,1)
>>>>         1: (211,167,184,255) #D3A7B8 rgba(211,167,184,1)
>>>>         1: (212,168,185,255) #D4A8B9 rgba(212,168,185,1)
>>>>         1: (218,172,189,255) #DAACBD rgba(218,172,189,1)
>>>>         1: (218,173,189,255) #DAADBD rgba(218,173,189,1)
>>>>         1: (218,173,190,255) #DAADBE rgba(218,173,190,1)
>>>>         1: (220,175,192,255) #DCAFC0 rgba(220,175,192,1)
>>>>         1: (225,178,196,255) #E1B2C4 rgba(225,178,196,1)
>>>>         1: (227,180,198,255) #E3B4C6 rgba(227,180,198,1)
>>>>         1: (228,181,198,255) #E4B5C6 rgba(228,181,198,1)
>>>>         1: (229,181,199,255) #E5B5C7 rgba(229,181,199,1)
>>>>         1: (230,182,200,255) #E6B6C8 rgba(230,182,200,1)
>>>>         1: (231,183,201,255) #E7B7C9 rgba(231,183,201,1)
>>>>         1: (236,187,206,255) #ECBBCE rgba(236,187,206,1)
>>>>         1: (242,192,211,255) #F2C0D3 rgba(242,192,211,1)
>>>>         1: (244,193,213,255) #F4C1D5 rgba(244,193,213,1)
>>>>         1: (248,197,216,255) #F8C5D8 rgba(248,197,216,1)
>>>>         1: (253,201,220,255) #FDC9DC rgba(253,201,220,1)
>>>>         1: (254,202,221,255) #FECADD rgba(254,202,221,1)
>>>>  Rendering intent: Undefined
>>>>  Interlace: None
>>>>  Background color: white
>>>>  Border color: rgba(223,223,223,1)
>>>>  Matte color: grey74
>>>>  Transparent color: none
>>>>  Page geometry: 64x64+0+0
>>>>  Dispose: Undefined
>>>>  Iterations: 0
>>>>  Compression: Zip
>>>>  Orientation: Undefined
>>>>  Properties:
>>>>    create-date: 2009-09-22T13:41:42-07:00
>>>>    modify-date: 2009-09-22T13:41:42-07:00
>>>>    signature:  
>>>> 4a28922a9b6af6abb7f62b21daae84bd3352c1e8b289142d88e35de3d424671e
>>>>  Artifacts:
>>>>    verbose: true
>>>>  Tainted: False
>>>>  Filesize: 661b
>>>>  Number pixels: 4kb
>>>>  Version: ImageMagick 6.5.2-9 2009-06-23 Q16 http://www.imagemagick.org
>>>>
>>>>
>>>>
>>>>
>>>> Should i post my image -- i thought we could not do that on the  
>>>> forum?
>>>>
>>>> Thanks a lot!
>>>>
>>>> S.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Sep 22, 2009, at 5:16 PM, Fred Weinhaus wrote:
>>>>> Hi Stephane,
>>>>>
>>>>>
>>>>> First, the proper IM 6 syntax is:
>>>>>
>>>>> convert wbtest.png -resize 64x64  out.png
>>>>>
>>>>> see http://www.imagemagick.org/Usage/basics/#cmdline
>>>>>
>>>>> but probably won't make any difference.
>>>>>
>>>>> But the main thing is to see what you have to start. So get a  
>>>>> verbose info on your input
>>>>>
>>>>> identify -verbose wbtest.png
>>>>>
>>>>> you will probably find that it has some transparency in it to  
>>>>> start with, perhaps the white is set to opaque white as  
>>>>> rgb(255,255,255,1), or there is an opaque alpha channel  or some  
>>>>> not fully opaque alpha channel on to make some color  
>>>>> transparent. Thus the opaque colors get coded with alpha=1  
>>>>> (opaque as opposed to the any non-opaque colors that would have  
>>>>> alpha<1 or even 0 for fully transparent.
>>>>>
>>>>> you will likely find that your image is not what you think it is  
>>>>> to start with.
>>>>>
>>>>> Send that back or post on the forum.  Or just post a link to  
>>>>> your image so that I or others can check it.
>>>>>
>>>>> Fred
>>>>>> Fred,
>>>>>>
>>>>>> Thanks for your reply. The command i am using is:
>>>>>>> convert -resize 64x64 wbtest.png  out.png
>>>>>>
>>>>>> # Get metadata for original image:
>>>>>>>
>>>>>>> identify -verbose wbtest.png > /tmp/wb
>>>>>> # Get metadata for transformed image
>>>>>>>
>>>>>>> identify -verbose out.png > /tmp/wb
>>>>>>
>>>>>> # Do a diff:
>>>>>>>
>>>>>>> diff wb wbt
>>>>>> 1c1
>>>>>> < Image: wbtest.png
>>>>>> ---
>>>>>>>
>>>>>>> Image: out.png
>>>>>> 113c113
>>>>>> <   Background color: white
>>>>>> ---
>>>>>>>
>>>>>>>  Background color: rgba(1,1,1,1)
>>>>>> ...
>>>>>>
>>>>>>
>>>>>>
>>>>>> Now, i tried with your suggestion but the background shows up  
>>>>>> as black (altough Background color says white)
>>>>>>> convert -resize 64x64  wbtest.png -alpha off out.png;   
>>>>>>> identify -verbose out.png | grep Background
>>>>>> Background color: white
>>>>>>
>>>>>>
>>>>>> All i want is keep the image as it was before the resizing.
>>>>>>
>>>>>>
>>>>>> Any ideas?
>>>>>>
>>>>>> S.
>>>>>>
>>>>>> On Sep 22, 2009, at 3:10 PM, Fred Weinhaus wrote:
>>>>>>>
>>>>>>> What is your exact command? You have probably done something to
>>>>>>> either add transparent colors or turn on the alpha channel
>>>>>>> everywhere. If you want to turn it off everywhere, then at the  
>>>>>>> end of
>>>>>>> your command line just before the output image add -alpha off  
>>>>>>> (or
>>>>>>> +matte).
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I am doing a simple resize operation on an image with a white
>>>>>>>>
>>>>>>>> backgound, and when i look at the result, i see that the  
>>>>>>>> background
>>>>>>>> has changed:
>>>>>>>> <   Background color: white
>>>>>>>> ---
>>>>>>>>>
>>>>>>>>> Background color: rgba(1,1,1,1)
>>>>>>>>
>>>>>>>>
>>>>>>>> Is that intended? Is there any option i could turn on to  
>>>>>>>> prevent that.
>>>>>>>> That seems to not give the expected result on IE6?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> S.
>>>>>>> _______________________________________________
>>>>>>> Magick-users mailing list
>>>>>>> [email protected]
>>>>>>> http://studio.imagemagick.org/mailman/listinfo/magick-users
>
>

_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to