Resize png image in Delphi - incorrect alpha channel -


i resizing png images might have alpha channel.

everything works good, 1 exception: gray pixels around transparent areas.

the original image doesn't have drop shadows.

is there way fix / work around?

wrong alpha value

i using smoothresize gustavo daud (see first answer this question), resize png image.

i cannot provide code using did not write , not have author's permission publish it.

i suspect caused 2 things: funny rgba values in png , naive resizing code.

you need check png contents. looking rgb values in transparent areas. despite transparent areas having alpha @ 0, still have rgb info. in case expect transparent areas filled black rgb value. might cause grey outline after resize if resize done naively. example: happens if code resizes 2 adjustent pixels (0,0,0,0) , (255,255,255,255) one? both pixels contribute 50% result 128,128,128,128) semi-transparent grey. same thing happens when upscale e.g x1.5, added pixel inbetween original 2 grey. not happen because image-editing software smart enough fill invisible pixels color nearest visible pixel.

you can try "fix" png filling transparent areas white (or color on border of images).

another approach use advanced resizing code (write or find library), ignore transparent pixels rgb values (e.g. taking rgb closest non-transparent pixel).


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -