I read this older blog post, "https://dev.fitbit.com/blog/2018-05-09-introducing-the-imagepicker-and-image-api/"
that mentions the following:
"One approach which tends to work well is to convert the source image into a jpeg with medium compression (40-50), then use the JPEG API on the device to save the jpeg as a txi file. "
Now I'm trying to convert my existing bundled jpegs (located within `/resources` directory) to `.txi`, however not getting any luck.
Tried the following:
jpeg.decodeSync('bg-blue-348.jpg', outFileName)
Answered! Go to the Best Answer.
Here's an extract from something of mine (that works):
const dataDir = "/private/data/";
jpeg.decodeSync('/mnt/assets/resources/0.jpg', dataDir+'0.txi');Unfortunately, that error you're getting is rather generic. It could mean unexpected JPEG format (eg, progressive), invalid destination directory, pre-existing destination file (and not using overwrite:true), and more.
Best AnswerUnfortunately, still no luck.
Best AnswerHere's an extract from something of mine (that works):
const dataDir = "/private/data/";
jpeg.decodeSync('/mnt/assets/resources/0.jpg', dataDir+'0.txi');Unfortunately, that error you're getting is rather generic. It could mean unexpected JPEG format (eg, progressive), invalid destination directory, pre-existing destination file (and not using overwrite:true), and more.
Best AnswerAh I see my mistake, I have my images located within resources/assets, so my absolute path was `/mnt/assets/resources/assets/<image>.jpg`, instead I was using `/mnt/resources/assets/<image>.jpg`.
Thanks @Gondwana !
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
If you use PNG files in your project, they are automatically converted to TXI during the build process.
Best Answer