05-14-2022 11:32 - edited 05-14-2022 17:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-14-2022 11:32 - edited 05-14-2022 17:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi! I'm trying to put a png image on watch, but I can't... on Fitbit OS Simulator works like a charm, but not on watch...
What I'm doing wrong?
This is my app/index.js code:
inbox.onnewfile = () => {
let fileName;
do {
fileName = inbox.nextFile();
if (fileName) {
document.getElementById("coin").image = `/private/data/${fileName}`;
}
} while (fileName);
};

05-14-2022 11:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-14-2022 11:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
My watch is a Versa 3
05-14-2022 13:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-14-2022 13:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
If it works on sim but not watch, a common cause is because the image is the wrong size. The watch doesn't like resizing images.
Gondwana Software

05-14-2022 14:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-14-2022 14:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I tried to print it at full size (300x300) and I got the same behavior 😞

05-14-2022 15:42 - edited 05-14-2022 15:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-14-2022 15:42 - edited 05-14-2022 15:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I put a 300x300 image resized to 100x100 directly from resources and I see that image, but when runs this line
document.getElementById("coin").image = `/private/data/${fileName}`;
image become invisible...
maybe how I put the image have a problem...

05-14-2022 15:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-14-2022 15:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Try .href.
Gondwana Software

05-14-2022 15:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-14-2022 15:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
.image and .href has the same behavior

05-14-2022 17:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-14-2022 17:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
This is mi companion code:
fetch(coinURL)
.then(response => response.arrayBuffer())
.then(buffer => outbox.enqueue(destFilename, buffer))
.then(fileTransfer => {
console.log(`Enqueued ${fileTransfer.name}`);
});

05-14-2022 20:38 - edited 05-14-2022 20:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-14-2022 20:38 - edited 05-14-2022 20:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Well... using txi conversion it's working, but if I load the same .png directly it load... why I can't pass the file?
fetch(coinURL)
.then(response => response.arrayBuffer())
.then(buffer => Image.from(buffer, "image/png"))
.then(image =>
image.export("image/vnd.fitbit.txi", {
background: "#FFFFFF"
})
)
.then(buffer => outbox.enqueue(destFilename, buffer))
.then(fileTransfer => {
console.log(`Enqueued ${fileTransfer.name}`);
});

05-14-2022 20:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-14-2022 20:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
The watch doesn't support PNG. It can only display TXI and (some) JPG.
Gondwana Software

05-14-2022 20:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-14-2022 20:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
But I can load PNG from resources 😕

05-14-2022 20:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-14-2022 20:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
PNG included in the source are converted to TXI as part of the build process.
Gondwana Software

05-15-2022 07:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-15-2022 07:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
SDK could make the same thing if I try to set an image from an url response 😞

