lines when resizing a png with alpha transparency

63 views
Skip to first unread message

Jonathan Ong

unread,
Jul 14, 2013, 4:24:18 AM7/14/13
to webp-d...@webmproject.org
not sure if i explained it correctly. here's the source png, the EFF logo, and a webp version that is a 50% resize. I used the command cwebp -resize 1000 697 eff.png -o eff2.webp which is just resizing to 50%.

notice the lines around the circle as well as inside the E.

i'm using 0.3.1 on mac os x 10.8.4
eff.png
eff2.webp

oX Triangle

unread,
Jul 14, 2013, 2:41:10 PM7/14/13
to webp-d...@webmproject.org
reason: cwep try antialiasing a transparent pixel and use black for this.. hmmmmm
only way to fix this is to convert the 1bit-mask to an alphachannel (suggest: use photoshop)

oX Triangle

unread,
Jul 14, 2013, 2:43:58 PM7/14/13
to webp-d...@webmproject.org
for cwep developer my suggest..
add an option to define the transparent colour via an extra parameter

Pascal Massimino

unread,
Jul 15, 2013, 3:26:07 PM7/15/13
to WebP Discussion
Jonathan,


On Sun, Jul 14, 2013 at 1:24 AM, Jonathan Ong <jonathanr...@gmail.com> wrote:
not sure if i explained it correctly. here's the source png, the EFF logo, and a webp version that is a 50% resize. I used the command cwebp -resize 1000 697 eff.png -o eff2.webp which is just resizing to 50%.

notice the lines around the circle as well as inside the E.

it looks like it's more a problem with the design of the original alpha mask in 'eff.png': the mask
is antialiased just at the white/black limit. You get the same lines if you just rescale to png
too, for instance:
  convert eff.png -scale 1000x697 eff2.png
(see attachement)
The original logo should really use 'white' as background / hidden color, so that the averaging
performed during downsampling is correct...

hope it helps,
skal


(side note: the logo's size in webp is even smaller if you use -lossless. But that's another topic)


i'm using 0.3.1 on mac os x 10.8.4

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.
To post to this group, send email to webp-d...@webmproject.org.
Visit this group at http://groups.google.com/a/webmproject.org/group/webp-discuss/.
For more options, visit https://groups.google.com/a/webmproject.org/groups/opt_out.
 
 

eff2.png

Jonathan Ong

unread,
Jul 15, 2013, 4:25:14 PM7/15/13
to webp-d...@webmproject.org
interesting. when i resized it locally, i didn't get any of those lines. 

thanks. i guess it isn't a problem with webp.


--
You received this message because you are subscribed to a topic in the Google Groups "WebP Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/a/webmproject.org/d/topic/webp-discuss/HRWcpWUR9m0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to webp-discuss...@webmproject.org.

Pascal Massimino

unread,
Jul 16, 2013, 10:20:30 AM7/16/13
to WebP Discussion
Jonathan,


On Mon, Jul 15, 2013 at 1:25 PM, Jonathan Ong <jonathanr...@gmail.com> wrote:
interesting. when i resized it locally, i didn't get any of those lines. 

thanks. i guess it isn't a problem with webp.

Actually, thinking of it, i think we can improve cwebp/dwebp to avoid this problem.
A tentative fix of cwebp is here: https://gerrit.chromium.org/gerrit/62090
(still WIP, need to iron out details like precision, speed, etc.).

I've entered the bug #160 for that: https://code.google.com/p/webp/issues/detail?id=160

Thanks for the report!
Reply all
Reply to author
Forward
0 new messages