@xuda.io/ai_module 1.1.4305 → 1.1.4306

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.mjs +18 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -6751,6 +6751,24 @@ const get_business_logo = async function (uid, name, account_profile_info) {
6751
6751
  };
6752
6752
 
6753
6753
  const return_image_blob_from_downloaded_image = async function (url) {
6754
+ async function imageToPngBlob(filePath) {
6755
+ const ext = path.extname(filePath).toLowerCase();
6756
+
6757
+ let buffer;
6758
+
6759
+ let is_transparent = false;
6760
+ if (ext === '.png') {
6761
+ buffer = await fs.promises.readFile(filePath);
6762
+ is_transparent = await hasTransparentBackground(filePath);
6763
+ } else {
6764
+ console.log(`Converting ${path.basename(filePath)} to PNG...`);
6765
+ buffer = await sharp(filePath).png({ quality: 100, compressionLevel: 9, force: true }).toBuffer();
6766
+ }
6767
+
6768
+ // Create a Blob with correct MIME type
6769
+
6770
+ return { is_transparent, image_blob: new Blob([buffer], { type: 'image/png' }) };
6771
+ }
6754
6772
  try {
6755
6773
  if (!url) {
6756
6774
  throw new Error('No URL provided in request');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4305",
3
+ "version": "1.1.4306",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",