Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

AppFusion - 6 in 1!
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-24-2009, 07:04 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 812
Default How to merge two images?

There must be some easy way with the blending mode and core graphics, but I haven't been able to get it to work correctly.

How do I merge two images 50-50?
johnqh is offline   Reply With Quote
Old 03-24-2009, 07:58 PM   #2 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 622
Default

Quote:
Originally Posted by johnqh View Post
There must be some easy way with the blending mode and core graphics, but I haven't been able to get it to work correctly.

How do I merge two images 50-50?
Not sure if I completely understand what you're trying to do, but can't you just set their alpha to .5 and display one on top of the other?
DenVog is offline   Reply With Quote
Old 03-24-2009, 09:03 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 812
Default

Quote:
Originally Posted by DenVog View Post
Not sure if I completely understand what you're trying to do, but can't you just set their alpha to .5 and display one on top of the other?
I have no problem with displaying. However, I want a new UIImage from two.

I have played with the 0.5 alpha but it didn't come out right. It looks the 2nd image is more obvious.

Last edited by johnqh; 03-24-2009 at 09:07 PM.
johnqh is offline   Reply With Quote
Old 03-24-2009, 11:34 PM   #4 (permalink)
Registered Member
 
Join Date: Jul 2008
Location: Minneapolis, MN
Posts: 208
Default

Well, you definitely don't want the bottom one % 0.5 - just the top one. If you can get it working that way it is much easier. Otherwise you have to draw the images manually to a context.
Scuba is offline   Reply With Quote
Old 03-25-2009, 12:41 AM   #5 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 812
Default

Quote:
Originally Posted by Scuba View Post
Well, you definitely don't want the bottom one % 0.5 - just the top one. If you can get it working that way it is much easier. Otherwise you have to draw the images manually to a context.
I am using context and drawing 1st one with alpha of 1, 2nd image with alpha of 0.5. No use, it doesn't come out correctly. The 1st image looks too light.

I am sure someone here have done similar things on Mac OSX. Please share. Exactly what kind of blending mode and alpha should I use?
johnqh is offline   Reply With Quote
Old 03-25-2009, 02:01 PM   #6 (permalink)
New Member
 
Join Date: Feb 2009
Posts: 47
Default

Quote:
Originally Posted by johnqh View Post
I am using context and drawing 1st one with alpha of 1, 2nd image with alpha of 0.5. No use, it doesn't come out correctly. The 1st image looks too light.

I am sure someone here have done similar things on Mac OSX. Please share. Exactly what kind of blending mode and alpha should I use?
have you tried drawing one image over another image with Opaque set to NO?

We accidentally did this once when we wanted to remove the old image and it drew on top of the old one. Not really sure how it came out because they were similar images and there were only slight differences that showed up where we could tell they were overlapping, but you might want to try that instead of changing the alpha setting.

Not really sure how to duplicate this since it was a bug and we corrected it, but we basically loaded image views into an array and then we used the array to draw the images on the screen and we accidentally overlapped the images instead of removing the old ones.
General is offline   Reply With Quote
Old 09-13-2009, 01:54 PM   #7 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 23
Default

Code:
UIGraphicsBeginImageContext(firstImage.size);
[firstImage drawAtPoint:CGPointMake(0,0)];
[secondImage drawAtPoint:CGPointMake(0,0)];
	
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
HardyMacia is offline   Reply With Quote
Old 10-13-2009, 01:18 AM   #8 (permalink)
Registered Member
 
vikysaran's Avatar
 
Join Date: Jul 2009
Location: New Delhi
Posts: 129
Default

Quote:
Originally Posted by HardyMacia View Post
Code:
UIGraphicsBeginImageContext(firstImage.size);
[firstImage drawAtPoint:CGPointMake(0,0)];
[secondImage drawAtPoint:CGPointMake(0,0)];
	
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
this will capture current screen into 'newImage' from co-ordinates (0, 0)
__________________
Thanx & Regards-
Vaibhav Saran | Software Engineer
Neo Sypher Systems Pvt. Ltd.
New Delhi | India
Websites:
http://www.iphonesaura.com/
http://www.apptango.com/

vikysaran is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 641
24 members and 617 guests
ADY, BrianSlick, cotzy, Creativ, dacapo, Dattee, e2applets, gbenna, IphoneSdk, iseff, jakerocheleau, Jamarsoft, jbro, JiDai, kampftrinker, linkmx, mashercakes, nimesh_158, Reyna, touchcream, ukneeq, yurikus
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 160,619
Threads: 89,833
Posts: 383,488
Top Poster: BrianSlick (7,243)
Welcome to our newest member, yurikus
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:38 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0