What's the best way to optimize the output .prg?

Hello,

I have a watchface (Venu only) with 10 png backgrounds. The output .prg is 4MB! Each .png is compressed, no transparency and has less than 50kb. But somehow the output is way bigger than expected. If I remove the 10 background pngs, the .prg is less than 200kb, so I guess it's the resource compiler that increases the size that much by converting the png to other format... Tried with .jpg also, same result.

Is there anything I can do to reduce the .prg size? Any other image format that I can use?

Thanks.

Top Replies

  • Each .png is compressed, no transparency and has less than 50kb. But somehow the output is way bigger than expected.

    We normally store the bitmap data in an uncompressed raw format, but we do…

All Replies

  • What are you using for the palette when you define the bitmap resource?  See the programmer's guide in the section on bitmaps

  • I did not set a palette. If I put all 256 colors in palette, the .prg file size will be reduced with about 150kb per image, but the resulted image is bad compared to the original one. And I wish to have good quality images, that's why I'm targeting only Venu.

  • Understand that the palette defines how much space the bitmap takes.  If the pallet is just set to black and white, each pixel can be defined by one bit.  As the palette increases, it takes more to define  each pixel, so larger.  I'm not sure how many colors are possible on the venu, but in devices.xml, it has BPP set to 16, while other devices are  8,4,1, with 1  being a monochrome, like the edge 130.

    So the way to reduce  the size is  reduce the palette, as you saw with reducing it to 256 colors.  Maybe you can find  a better palette for your bitmaps.  The only other way to help with memory is reduce the  number of bitmaps.

  • Each .png is compressed, no transparency and has less than 50kb. But somehow the output is way bigger than expected.

    We normally store the bitmap data in an uncompressed raw format, but we do have functionality in place to allow you to specify the bitmap data should be compressed. You just need to add a compress="true" attribute to the bitmap definition in your resource files. Something like this...

    <resources>
      <bitmap id="id_image_compressed"   filename="images/image.png" dithering="floyd_steinberg" compress="true"/>
      <bitmap id="id_image_uncompressed" filename="images/image.png" dithering="floyd_steinberg" compress="false"/>
    </resources>

    This functionality has been available for some time, but the documentation has never been updated to reflect that it exists. I'll add documentation for this today.

  • Thank you very much!!!! It works, the .prg size is now smaller and the quality of the images is not affected!

    Maybe you guys can do something about the 9MB limit for installed apps/wf on the Venu :D