How to copy alphadata between 2 images

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
capellan
Posts: 607
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

How to copy alphadata between 2 images

Post by capellan » Tue Nov 22, 2016 3:02 am

1- Import an Image without Transparency...

2A- Import a transparent PNG or
2B- Take a snapshot with effects of a vector graphic...

on mouseUp
import snapshot from grc 1 with effects
end mouseUp

3- Put the transparent PNG on top of
the image without transparency...

4- Run this script to create a mask from PNG...

on mouseUp
set the locklocation of img 1 to true
import snapshot from img 1
set the loc of last img to the loc of img 1
delete img 1
-- after deleting img 1 (an image without transparency),
-- then img 2 (a transparent png) becomes img 1

crop img 2 to the rect of img 1

set the width of img 1 to the width of img 2
set the height of img 1 to the height of img 2

set the alphadata of image 2 to the alphadata of image 1
end mouseUp
LiveCode Set Alphadata from Transparent PNG.jpg
Stack screenshot
Alphamask from Transparent PNG.livecode.zip
LiveCode stack
(1.12 KiB) Downloaded 101 times

capellan
Posts: 607
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Re: How to copy alphadata between 2 images

Post by capellan » Sat Nov 26, 2016 1:31 am

Just for reference... :D
Checking old forum threads, I found that years ago,Klaus Major
had posted this same method in another thread:
http://forums.livecode.com/viewtopic.php?f=7&t=11553

Al

Post Reply

Return to “Rich Media”