encode text to image

Wilhelm Sanke sanke at hrz.uni-kassel.de
Fri Sep 1 17:24:14 EDT 2006


On Thu Aug 31, 2006, Dar Scott dsc at swcp.com wrote:

> > Maybe I am missing something very simple here, but all variations I  
> > tried with the "text" property failed.-
>
> I don't see it on Rev 2.7.3 on G4 with OS X 2.7.3 even after going to  
> another card and back.
>
> Could there be some setting of paintCompression that affects this?
>
> There is a bug in which some images do not render correctly and a bug  
> in which some lose transparency on card changes.  Maybe those are  
> related.
>
> Maybe there is an unexpected formatting option in an imported image.
>
> Dar



Thanks Dar for the information, I finally succeeded to some extent:

The "text of image" property apparently does not work in the MC IDE, 
regardless of which engine is used, old or new ones - from 2.4 to 2.7.3.

I prefer to develop in the Metacard IDE, especially when dealing with 
imagedata, among other reasons because the execution of scripts for 
imagedata handling is markedly slower in the Rev IDE, up to 45 % slower 
with some scripts than in the MC IDE.
It is possible to get some sort of "text of image" data in the MC IDE ( 
"put the text of image X into imagetext" or "into fld "Imagetext""), but 
setting the text of the image again to the extracted imagetext data 
results in a blank picture as I reported in my earlier post.
Additionally, the image becomes fully transparent.
You have to set the alphadata of the image to opaque to make it visible 
again, and it then shows as a monochrome picture with color values 
apparently dependant on the structure of the vanished image. You get all 
kinds of monochrome colors ranging from black to white or shades of any 
colors.

I succeeded with the Rev IDE - using the same engines as before - so I 
have to conclude that the "text of image"-property is at least partially 
handled somewhere in the IDE. The same holds for standalones. The 
behaviors in the MC and Rev standalones are identical to those in the 
IDEs, meaning that the relevant part of the Rev IDE is added to the Rev 
standalone. As far as I tested it, no differences come up between MacOS 
and Windows in these respects.

There is one difference between Rev IDE and Rev standalone: The chars of 
the retrieved text of the image are displayed differently.

Another limitation this time holding both for Metacard and Revolution: 
When I import new images into the stack - I tried with PNG and JPG files 
of various sizes and compression ratio - their "text of image"-data are 
invariably *empty* here!! Only after manipulating the imagedata of the 
image (or storing it and restoring it from the imagedata) any "text of 
image"-data are accessible.

Text-of-image data in Rev, when displayed in a field, show "PNG" as 
chars 2 to 4, irrespective of the prior format of the images, i.e. it 
doesn't matter if they are JPG or PNG images or are images created from 
scratch by setting the imagedata to some color pattern. In the MC IDE 
this header "PNG" never appears when text-of-image data are extracted 
from an image.--

So what could be the benefits of using text-of-image data instead of  
"imagedata"?
One thing I noticed is that restoring an image from text data is 
somewhat faster than using imgedata. Otherwise I see no advantage.

The imagedata of an image of the same width and height are always the 
same in terms of the number of chars. With text-of-image data the 
numbers of chars differ with each image, making it impossible to 
manipulate the text-of-image data in a consistent way like I am able to 
do with image data (filters, mirroring, creating new images etc. etc.) 
like I have implemented it in my forthcoming "Imagedata Toolkit". I had 
underestimated the time to complete a presentable version of that 
toolkit that comprises about 200 options to manipulate imagedata and I 
needed to explore a number of ideas I choose to integrate in that toolkit.

Regards,

Wilhelm Sanke
<http://www.sanke.org/MetaMedia>





More information about the use-livecode mailing list