01-10-2023 01:13 AM
I have used a picture control in my Labwindows uir. An image of size 4MB (jpg) is loaded into the control. This is causing the application size of 64 MB instead of 3MB with a bmp file of 1MB . What is the cause for this and how to reduce the application size?
Solved! Go to Solution.
01-10-2023 02:28 AM
.JPG and .PNG are compressed image formats: internal algorithms make file on disk footprint more or less huge depending on image characteristics and the efficiency of compression. .BMP files on the contrary are not compressed. When you load an .JPG or .PNG image into a CVI picture control all that compression is lost and the image in memory gets its true size (and so does the .UIR file).
What you may do is to choose a different image or manipulate the image to reduce its internal size Just as an example you may rescale the image to picture control dimensions if larger.
Consider that a picture of mine which is 2300*3400 pixels is stored in a 2.3MB .JPG file, but if saved as a 24-bit bitmap results in a 32 MB file! If reduced to 25%in each direction dimensions become 234 kB and 1.3MB respectively.
A significative memory saving may be obtained by reducing the color depth, for example using a 256-color image if possible.
The alternative of loading the picture at runtime only reduces the UIR file size: it has no effect on memory footprint once the image is loaded which depends on image characteristics.
01-16-2023 04:19 AM
Thanks a Lot. By changing image resolution to picture control size has reduced the size of jpg file and in turn size of uir and application file.