open-wa / wa-automate-nodejs

💬 🤖 The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.11k stars 591 forks source link

Is able to send png transparent? #1204

Closed aidilaryanto closed 3 years ago

aidilaryanto commented 3 years ago

Is able to send transparent image with format png?

kmirea commented 3 years ago

WhatsApp by default, or at least via Web-WhatsApp will always convert pngs and svg to a raster (jpg ?) . You lose all transparency. I am forced in my dayjob, to first zip up any png/svg. So thus, i am almost certain you cannot send PNG while preserving transparency. Its unfortunate, but its an issue of WhatsApp itself.

smashah commented 3 years ago

Thanks for the details @kmirea

@aidilaryanto If transparency is important then I suggest sending it as a sticker. Otherwise send it using:

https://docs.openwa.dev/classes/client.html#sendfile

with withoutPreview param as true.

Closing for now.

Thanks

dhino12 commented 2 years ago

or you can do it by using

const bufferBase64 = `data:application/x-zip-compressed;base64,${ yourBase64Img }`;
await client.sendFile(from, bufferBase64, 'foto-nobg.png', 'fotonya tuan' ,false, false, false, true);

by adding withoutPreview params as true and add extension file name as .png in fileName param