nodeca / pica

Resize image in browser with high quality and high speed

Home Page:http://nodeca.github.io/pica/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] Save Transparency as White When Resizing as JPG

jlukic opened this issue · comments

Thanks for the wonderful project, the webassembly usage is one of the few I've seen in open-source like this and quite brilliant.

Feature Request

Modify default behavior for alpha: false to squash transparencies to white instead of black, or provide a configuration for how to render alpha layers when resizing to non-alpha format like jpg.

Use Case

When you have websites that support image uploads, often times you want to support a variety of image formats like png and gif for uploads, but want the final results to be without alpha layers by removing them in a reasonable way for display. For example when allowing user avatar uploads.

Current Behavior

Resize an image with transparency like
apis

Current Behavior (Squashes to Black)
vzH8puuCybTuTdQdv

Requested Behavior (Squash transparency to white)
white

That's out of scope. In v9 you have canvas output with correct alpha channel. After resize you can apply any background you wish via canvas api.