Image Manipulation
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
- 
				teacherguy
- Posts: 379
- Joined: Thu Dec 08, 2011 2:43 am
Re: Image Manipulation
Chris this is really great work, thank you so much
			
			
									
									
						Re: Image Manipulation
Thank You, Hope you find it useful, keep a look out for the next update. It will have graphic and tool integration, and more customizeable filters options.
			
			
									
									Chris Bodell
Photo Room - (Editor Download)
						Photo Room - (Editor Download)
Re: Image Manipulation
If anyone is interested in taking part designing a GUI for the PhotoRoom Engine feel free to reply, tools and panels would be integrated, for customization of functions. Feel to email me. 
Chris
cbodell@live.com
			
			
									
									Chris
cbodell@live.com
Chris Bodell
Photo Room - (Editor Download)
						Photo Room - (Editor Download)
- 
				FourthWorld
- VIP Livecode Opensource Backer 
- Posts: 10065
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Image Manipulation
Chris, that's quite a compendium of useful handlers.  I may be able to use a few of those functions somewhere down the road, but I don't fully understand the About stack's license terms, which says only "Free without reference".
Do you mean "free" as in "public domain", or "free" as in some other license terms?
I would of course at a minimum give credit with "Portions Copyright 2012 Chris Bodell", unless you prefer to use a company name as the copyright holder. If public domain I would be happy to use "Portions contributed to the public domain by Chris Bodell".
How would you like attribution, and do you take PayPal donations? If I use some of this I'll at least kick in for dinner.
			
			
									
									Do you mean "free" as in "public domain", or "free" as in some other license terms?
I would of course at a minimum give credit with "Portions Copyright 2012 Chris Bodell", unless you prefer to use a company name as the copyright holder. If public domain I would be happy to use "Portions contributed to the public domain by Chris Bodell".
How would you like attribution, and do you take PayPal donations? If I use some of this I'll at least kick in for dinner.

Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
						LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Image Manipulation
Hi Fourth World,
That was the quickest way i could write out the "About" stack for an update. I actually provide if free to the public, no reference meaning you don't have to reference me as the owner, writer. I would take paypal, but i would prefer it be used anyway, instead of sitting on a hard drive. Donations are your choice.
I began writing the stack because i wanted to design different grayscale methods. But i got a little side tracked. Anyway, use it as you need, i would love to see a good application base for it.
Chris
			
			
									
									That was the quickest way i could write out the "About" stack for an update. I actually provide if free to the public, no reference meaning you don't have to reference me as the owner, writer. I would take paypal, but i would prefer it be used anyway, instead of sitting on a hard drive. Donations are your choice.
I began writing the stack because i wanted to design different grayscale methods. But i got a little side tracked. Anyway, use it as you need, i would love to see a good application base for it.
Chris
Chris Bodell
Photo Room - (Editor Download)
						Photo Room - (Editor Download)
- 
				FourthWorld
- VIP Livecode Opensource Backer 
- Posts: 10065
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Image Manipulation
For PayPal, would I use the email address in the About box?
As for the code, it's great stuff but there may be some opportunities for speed improvement in the repeat loops, since many use "repeat with..." where "repeat for each..." would be faster.
It's a bit tricky in the places you're using it, since you need to follow specific bounds that relate to the image coordinates. Not a simple optimization, but if I get some somewhere down the road when I get a chance to use it I might try my hand at seeing if there's an efficient way to refactor those repeats to use the parse-as-it-goes "repeat for each..." method.
And if I do, of course I'll honor the generous spirit in which you've shared this massive library and post them as public domain which you could include in the master copy if you choose to.
If anyone else here has time to explore that I'd be interested in how it goes. I'm fairly certain those loops can be sped up, but given the constraints they address it's not as obvious as many other optimizations.
			
			
									
									As for the code, it's great stuff but there may be some opportunities for speed improvement in the repeat loops, since many use "repeat with..." where "repeat for each..." would be faster.
It's a bit tricky in the places you're using it, since you need to follow specific bounds that relate to the image coordinates. Not a simple optimization, but if I get some somewhere down the road when I get a chance to use it I might try my hand at seeing if there's an efficient way to refactor those repeats to use the parse-as-it-goes "repeat for each..." method.
And if I do, of course I'll honor the generous spirit in which you've shared this massive library and post them as public domain which you could include in the master copy if you choose to.
If anyone else here has time to explore that I'd be interested in how it goes. I'm fairly certain those loops can be sped up, but given the constraints they address it's not as obvious as many other optimizations.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
						LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Image Manipulation
It's cbodell@live.com. Im not quite sure if i have the correct one listed.
About the speed improvement, most of the filters can easily be switched the repeat for each, i actually spent a couple of weeks doing that. When it gets to the more complex structures, it gets a bit more tricky to track down the errors, but for the most part, as long as dimension presets are stated in the calls, it's quite simple. I designed some graphic tools and Bézier curves with point mainupulation, and had some neat pen & marker tools, layer and history, but in my last move, i lost the drive that had the backup, and accidently deleted the formal copy. It's a shame, i was looking forward to the release.
Im actually working with trials versions, so i have to constantly inquire for a new license file. As soon i can invest in a license i'm going to get back to work. It's time consuming when i'm designing alone though.
As for the optimazation again, most of the filters i remodeled the repeat structure of increases but a couple of seconds. Some of the other functions like flakes, tiles, water drops, etc can be optimized dramatically. Writing them so fast i didn't include boundary statements and conditional operations, so if an iteration is outside the boundaries and the code has to loop, or pixel location is invalid, the time for the filter is almost literally doubled. One i improved from 17 seconds to 4. The tile filters i believe.
Anyway, i'm going to dive back into the code soon, and give the engine an overhaul, once i redesign the GUI ill post the next major update.
I'd also like to add brush effects for a custom brush tool, but i need to design a stamp-like function, that's efficient in tracking the mouseLoc. Any ideas or leads for a good start would be great.
Chris
			
			
									
									About the speed improvement, most of the filters can easily be switched the repeat for each, i actually spent a couple of weeks doing that. When it gets to the more complex structures, it gets a bit more tricky to track down the errors, but for the most part, as long as dimension presets are stated in the calls, it's quite simple. I designed some graphic tools and Bézier curves with point mainupulation, and had some neat pen & marker tools, layer and history, but in my last move, i lost the drive that had the backup, and accidently deleted the formal copy. It's a shame, i was looking forward to the release.
Im actually working with trials versions, so i have to constantly inquire for a new license file. As soon i can invest in a license i'm going to get back to work. It's time consuming when i'm designing alone though.
As for the optimazation again, most of the filters i remodeled the repeat structure of increases but a couple of seconds. Some of the other functions like flakes, tiles, water drops, etc can be optimized dramatically. Writing them so fast i didn't include boundary statements and conditional operations, so if an iteration is outside the boundaries and the code has to loop, or pixel location is invalid, the time for the filter is almost literally doubled. One i improved from 17 seconds to 4. The tile filters i believe.
Anyway, i'm going to dive back into the code soon, and give the engine an overhaul, once i redesign the GUI ill post the next major update.
I'd also like to add brush effects for a custom brush tool, but i need to design a stamp-like function, that's efficient in tracking the mouseLoc. Any ideas or leads for a good start would be great.
Chris
Chris Bodell
Photo Room - (Editor Download)
						Photo Room - (Editor Download)
Re: Image Manipulation
Hi Chris,
Simplepaint work with the imagedata and you can draw without revpaint tools
You can download it here (307 ko):
http://www.alternatic.ch/jmb/DevLiveCod ... ePaint.zip
Best regards
Jean-Marc
			
			
									
									If i understand what you want, "SimplePaint" should be useful for your project (I'm not the author).i need to design a stamp-like function, that's efficient in tracking the mouseLoc. Any ideas or leads for a good start would be great.
Simplepaint work with the imagedata and you can draw without revpaint tools
You can download it here (307 ko):
http://www.alternatic.ch/jmb/DevLiveCod ... ePaint.zip
Best regards
Jean-Marc
https://alternatic.ch
						Re: Image Manipulation
Hi Chris,
http://forums.runrev.com/phpBB2/viewtop ... =30#p43129
Kind regards
Bernd
			
			
									
									
						have a look at this thread and the alpha_paint stack of Luisa KloseI'd also like to add brush effects for a custom brush tool, but i need to design a stamp-like function, that's efficient in tracking the mouseLoc. Any ideas or leads for a good start would be great
http://forums.runrev.com/phpBB2/viewtop ... =30#p43129
Kind regards
Bernd
Re: Image Manipulation
Hi Bernd & Jean-Marc,
Are these stacks/samples something i can use and alter? Do i need to use a reference to the author? And are they efficient enough to keep up with the mouseLoc tracking at variable speeds? I'm on a business computer so ill have a look when i get home, i think i've ran into the alpha_paint stack before. I'll have a look though.
Thank You
Chris
			
			
									
									Are these stacks/samples something i can use and alter? Do i need to use a reference to the author? And are they efficient enough to keep up with the mouseLoc tracking at variable speeds? I'm on a business computer so ill have a look when i get home, i think i've ran into the alpha_paint stack before. I'll have a look though.
Thank You
Chris
Chris Bodell
Photo Room - (Editor Download)
						Photo Room - (Editor Download)
Re: Image Manipulation
Hi Chris,
Sorry. I don't know who is the author of simple paint
Best regards
Jean-Marc
			
			
									
									Sorry. I don't know who is the author of simple paint
Best regards
Jean-Marc
https://alternatic.ch
						Re: Image Manipulation
Chris, Jean-Marc...
I think that Colin Holgate was the author of 'simple paint'...
be well
Dixie
			
			
									
									
						I think that Colin Holgate was the author of 'simple paint'...
be well
Dixie
- 
				teacherguy
- Posts: 379
- Joined: Thu Dec 08, 2011 2:43 am
Re: Image Manipulation
Looking at for example the autobrighten handler, is that one that could be converted to "for each?" Would love to see that get a little speed bump!
			
			
									
									
						Code: Select all
function addFilter_AutoBrighten pImage,pStyle,pStyle2,tAmount
   if pImage is empty then exit to top
   put the imageData of pImage into tData
   put the width of pImage into pWidth
   put the height of pImage into pHeight
   repeat with y = 1 to pHeight
      repeat with x = 1 to pWidth
         put charToNum(char ((y - 1) * pWidth * 4) + ((x - 1)  * 4) + 2 of tData) into tRed
         put charToNum(char ((y - 1) * pWidth * 4) + ((x - 1)  * 4) + 3 of tData) into tGreen
         put charToNum(char ((y - 1) * pWidth * 4) + ((x - 1)  * 4) + 4 of tData) into tBlue
         put (tRed + tGreen + tBlue)/3 into pHold
         put pHold/255 into tPercent
         put (tAmount*2) * tPercent into pHold
         put pHold - tAmount into pHold
         if pStyle is "1" then
            --Adjust High & Low Levels
            put pHold into pHold
         else if pStyle is "2" then
            --Adjust High Levels Only
            if (pHold < 0) then
               put 0 into pHold
            end if
         else if pStyle is "3" then
            --Adjust Low Levels only
            if (pHold > 0) then
               put 0 into pHold
            end if
         end if
         
         put the round of (16 + ((.183 * tRed) + (.614 * tGreen) + (.062 * tBlue))) into tY
         put the round of (128 + (((-.101) * tRed) + ((-.339) * tGreen) + (.439 * tBlue))) into tCb
         put the round of (128 + ((.439 * tRed) + ((-.339) * tGreen) + ((-.040) * tBlue))) into tCr
         if pStyle2 is 1 then 
            add pHold to tY
         else if pStyle2 is 2 then
            subtract pHold from tY
         end if
         put the round of ((1.164 * (tY - 16)) + (0.000 * (tCb - 128)) + (1.793 * (tCr - 128))) into tRed
         put the round of ((1.164 * (tY - 16)) + ((-0.213) * (tCb - 128)) + ((-0.533) * (tCr - 128))) into tGreen
         put the round of ((1.164 * (tY - 16)) + (2.112 * (tCb - 128)) + (0.000 * (tCr - 128))) into tBlue
         if tRed < 0 then put 0 into tRed
         if tGreen < 0 then put 0 into tGreen
         if tBlue < 0 then put 0 into tBlue
         if tRed > 255 then put 255 into tRed
         if tGreen > 255 then put 255 into tGreen
         if tBlue > 255 then put 255 into tBlue
         put numToChar(tRed) into char (((y - 1)) * pWidth * 4) + (((x - 1))  * 4) + 2 of tData
         put numToChar(tGreen) into char (((y - 1)) * pWidth * 4) + (((x - 1))  * 4) + 3 of tData
         put numToChar(tBlue) into char (((y - 1)) * pWidth * 4) + (((x - 1))  * 4) + 4 of tData
      end repeat
      
   end repeat
   set the imageData of pImage to tData
   return "Render Complete!"
end addFilter_AutoBrighten
Re: Image Manipulation
Teacherguy,
Yes, it definitely could have a speed boost, ill give that filter and overhaul and get back to you as soon as i can.
Chris
			
			
									
									Yes, it definitely could have a speed boost, ill give that filter and overhaul and get back to you as soon as i can.
Chris
Chris Bodell
Photo Room - (Editor Download)
						Photo Room - (Editor Download)

