Displaying Images in Rev
Tim Ponn
alptex2 at orwell.net
Thu Feb 24 15:14:15 EST 2011
Thanks, but it still doesn't work.
I think I failed to describe exactly what it is that I've got here.
I have a stack with a single empty image object, we'll call it "Test1"... and 20 fields. Further, I have a file that contains both binary jpeg image data and readable text. Each "record" within the file (about 19,000 records) consists of first the jpeg data and then the readable text. On startup, I load the entire file into a global. I click a button, respond to an ask dialog and it locates the record within the global. The script then extracts the chunks of readable data and fills in the 20 fields appropriately. Lastly, I am left with the jpeg data which I would like to display in the empty image object, :Test1".
I think I have multiple problems...
1...I must set the rect of the empty image to whatever image I'm trying to put there. Jacque, you've confirmed this...now I have to find where the image size lurks in the binary data and apply it.
2...I load that file into the global using the "URL" method. Maybe it's no longer binary and therefore not the correct data type for the image?
If there's an easier way, I could use some help there. Has anyone got some code bits to share here?
Thanks!
On Feb 24, 2011, at 2:26 PM, J. Landman Gay wrote:
> On 2/24/11 12:58 PM, Tim Ponn wrote:
>> Hello all!
>>
>> I've got a file that has many jpg images embedded in it (something
>> like 19,000 or so). There's other data in there too. I can isolate
>> a particular record. I can see the binary jpeg data. I can copy
>> that data, create a new jpg file...then open that file with a jpeg
>> viewer and all is well. Now comes rev...once again, I can isolate
>> the image binary data...but when I set the image data to that data,
>> the image is mostly black with a narrow sliver at the left edge
>> that's shades of colors. Is this a problem because I don't have the
>> rect set correctly for my blank image?
>
> Yes, that's exactly it. The size of the containing image has to match the source image to the pixel, or the data will become corrupted.
>
> You can get around that by putting the source into the container without using the imagedata at all:
>
> put img "source image.png" into img "destination.jpg"
>
> The receiving image will resize to fit automatically if you have its lockLocation set to false.
>
> --
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
Best Regards,
Timothy R. Ponn
More information about the use-livecode
mailing list