Using loadImage(), the downloaded image size is enormous

Hello, everyone :grin:
When I use Scriptable to download images, a picture that was originally 4 MB in size, the size of the downloaded image is 30 MB.
I wonder what the problem is?
If I use Shortcuts GET URL Content to download, the downloaded image is 4MB, which is the normal size.

Here is my code:

let arr = [
  "https://wx3.sinaimg.cn/large/690fd572ly1heosb5j162j22u8468b2c.jpg",
  "https://wx4.sinaimg.cn/large/690fd572ly1heosba8qnij22u84684qr.jpg",
  "https://wx3.sinaimg.cn/large/690fd572ly1heosbh1l3sj22u84681l1.jpg",
];

for (value of arr) {
  let imageName = value.split("/").at(-1);
  let req = new Request(value);
  let img = await req.loadImage();
  let fm = FileManager.iCloud();
  let path = fm.bookmarkedPath("Shortcuts") + "/images/" + imageName;
  fm.writeImage(path, img);
}

Thanx in Advance

I think there might me some conversion happening with loadImage. Try using req.load() and fm.write() instead.

1 Like

I had the same issue, so I made a shortcut to rescale first my images

1 Like