416-621-9348 cgreaves@chrisgreaves.com Visit www.ChrisGreaves.com for this image! Chris_GEDC1894_Head (Small).JPG
Home Services Products

Embedded images (Home) ; Obtain set of original images on disk ; Build application ; Try with images embedded as images in a GUI form within the application ; Switch to images embedded as numeric strings within the application ; Converting a stored image to an ASCII string ; Converting an ASCII string to a stored image ; Optimizing storage of the embedded string ; Function to insert an image from an embedded string ; Macro to drive the function ; Essay with a string as a parameter (statement) ; Converting An Embedded String To A String ; Converting A String To An Array Of VBA Statements ; Converting an string of VBA assignment statements to an array of VBA code ; Converting an array of VBA code to a macro .


Loading

Toronto and Mississauga, Sunday, December 05, 2010 3:06 PM

Copyright © 1996-2010 Chris Greaves. All Rights Reserved.

Optimizing Storage Of The Embedded String

It has not escaped my attention that the conversion to string representations of the ASCII values need take place only when I encounter non-text characters in the binary file.

If I assume that the contents of an image file consist of randomly distributed byte values (an assumption that needs to be tested), then a proportion of those bytes will consist of displayable characters.

If the non-displayable characters come in sufficiently short bursts, then I might adopt a technique of optimizing space taken by my image-string, by using a sentinel character to announce the arrival of a sub-string of displayable characters; those character would take one byte each, there being no need to convert them to a string-representation of their ASCII form.

I elect to get the job done, and leave optimization until it is called for.

For example, ten 10 kb images occupy 100 kb of disk space. In encoded form, that will be 200kb, so the end-user appliaction will bloat by an extra 200kb. If the application is a simple template, this could represent a jump from 40 kb to 240 kb, and may mean optimization of storage is needed.

But if the template without images is 400 kb, then adding 200 kb may not be seen as a problem.


Loading

Toronto and Mississauga, Sunday, December 05, 2010 3:06 PM

Copyright © 1996-2010 Chris Greaves. All Rights Reserved.