export modified image without display?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Weasel73
Posts: 15
Joined: Wed Jan 31, 2007 2:57 am

export modified image without display?

Post by Weasel73 » Sun Dec 30, 2007 6:21 am

I'm trying to import an image. Have the user pick a color to change the tint of the image. Then export the changed image.

I don't however want the user to see the image.

So far here is what I got:

Code: Select all

    answer files "Select the files you wish to process:"
    put it into TheFilePath
    import paint from file TheFilePath into image "ImageFile" of card id 1028

    answer color with 255,255,255
    put it into Color2Tint1
 

    set the ink of image "ImageFile" to blendDifference  -- I don't know if this isn't the correct one for tinting.  Haven't found that yet.

    wait 10 tick

    export snapshot from rectangle (the rectangle of image "ImageFile") of card id 1028 to file "Thumbnail.png" as PNG
I've tried "export image" and various other formats of "export snapshot", but they just give me the original image without the ink changes. The above code is successful at giving me the modified image and outside of not figuring out the tinting yet. The main problem I'm having is exporting the changed image without the user seeing it. Is what I'm looking for possible in RR?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Dec 30, 2007 12:10 pm

Hi Weasel73,

Export the image itself instead of a snapshot of it.

Why the wait command?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Weasel73
Posts: 15
Joined: Wed Jan 31, 2007 2:57 am

Post by Weasel73 » Sun Dec 30, 2007 4:15 pm

I put the wait in there to test the following:

Code: Select all

export image "ImageFile" to file "Thumbnail.png" as PNG set the filetype to PNGf
When I use the above code the result is the image without the ink changes. The wait didn't help.

Is there another way to do this? Is something wrong with my export image code?
Mac OS X 10.5
iMac,
2 GHz Core 2 Duo
3 GB RAM
RadeonHD2400 128 MB

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Dec 30, 2007 11:19 pm

Hi Weasel73,

I've given it some thought and I believe that your original approach is the right thing to do.

To hide the process from the user, you can make a new window and move it off-screen, by setting its left to -100, for example. Currently, I don't know a better way.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Weasel73
Posts: 15
Joined: Wed Jan 31, 2007 2:57 am

Post by Weasel73 » Mon Dec 31, 2007 12:08 am

Thanks. That seems to work.
Mac OS X 10.5
iMac,
2 GHz Core 2 Duo
3 GB RAM
RadeonHD2400 128 MB

Post Reply