Combining two images into one

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
toddgeist
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 21
Joined: Sat Apr 15, 2006 9:12 pm

Combining two images into one

Post by toddgeist » Fri Oct 04, 2013 2:14 pm

hello,

I have two images that I would like to combine into one by placing one on top of the other. I need to maintain the transparency. I can see how this might be done by writing out new imageData from the combination of two imageData containers. But does anyone have any examples?

Thanks

Todd
Last edited by toddgeist on Fri Oct 04, 2013 2:52 pm, edited 1 time in total.

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Combining two images into one

Post by Klaus » Fri Oct 04, 2013 2:21 pm

Hi Todd,

naive question, but can't you "physically" put these two images on top of each other
on a card and then import a screenshot from that area?

Sounds much simpler than dealing with IMAGEDATA :D


Best

Klaus

toddgeist
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 21
Joined: Sat Apr 15, 2006 9:12 pm

Re: Combining two images into one

Post by toddgeist » Fri Oct 04, 2013 2:36 pm

doesn't snapshot just do a screenshot of the area? if so, won't that be lower resolution?

Todd

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Combining two images into one

Post by Klaus » Fri Oct 04, 2013 2:59 pm

Hi Todd,
toddgeist wrote:doesn't snapshot just do a screenshot of the area?
Yes, what else? :D

If you group these two images and then import a snapshot from the rect of that group,
transparency will be preserved.

But hey, I am just guessing from your sparse infos :D
toddgeist wrote:if so, won't that be lower resolution?
Well, a screenshot is a screenshot and has the resolution of the current monitor 8)

Best

Klaus

toddgeist
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 21
Joined: Sat Apr 15, 2006 9:12 pm

Re: Combining two images into one

Post by toddgeist » Fri Oct 04, 2013 6:36 pm

Klaus wrote:Hi Todd,
toddgeist wrote:doesn't snapshot just do a screenshot of the area?
Yes, what else? :D

Klaus
And that is why I am questioning if there is a better way.

Does imageData contain different information that what you would get from a snapshot?

Am I loosing resolution by doing a snapshot?

These are the basic questions

Todd

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Combining two images into one

Post by Simon » Fri Oct 04, 2013 6:43 pm

Hi Todd,
Yes, snapshot uses the current screen resolution, which is good enough if nothing else happens to the image. But if after the image merge you want to zoom in or print out or some other manipulation then you want to work with the image data. If you don't do anything else with the image then snapshot is the easy way.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

toddgeist
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 21
Joined: Sat Apr 15, 2006 9:12 pm

Re: Combining two images into one

Post by toddgeist » Fri Oct 04, 2013 6:53 pm

Thanks Simon, for verifying my concern with import snapshot. I do need to do other things with these images after I am done.

So now back to the original question :wink: Does anybody have any an examples that show how to merge two images using imageData?

Thanks

Todd

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Combining two images into one

Post by Simon » Fri Oct 04, 2013 7:10 pm

Have you looked at this:
http://lessons.runrev.com/s/lessons/m/4 ... processing

No, it's not about combining 2 images but it gives you info on working with imageData.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

toddgeist
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 21
Joined: Sat Apr 15, 2006 9:12 pm

Re: Combining two images into one

Post by toddgeist » Fri Oct 04, 2013 7:15 pm

I did see that lesson. It was helpful. I think I can figure this out. I was just hoping to not have to :wink:

Post Reply

Return to “Talking LiveCode”