Image Manipulation?

46 replies [Last post]
tomreynolds
User offline. Last seen 8 years 44 weeks ago. Offline
Joined: 27 Apr 2010

Hey guys,

So I was reading through the great walkthrough on how you created the 20th Anniversary Photoshop app ( http://developer.anscamobile.com/documentation/making-of-photoshop-20th-anniversary ) and saw at the bottom that apparently some of the image alterations were made using pixel-level bitmap manipulation features that haven't been made publicly available yet and that they are to be included with Corona 1.2.

Looking at the roadmap I don't see anything about this, except maybe in the Game Edition roadmap where it mentions bitmap manipulation in Q3.

Is this still a planned API? This type of stuff would be absolutely amazing to provide access for I think.

Replies

Eric
User offline. Last seen 9 years 16 weeks ago. Offline
Joined: 23 Jun 2009

We're considering it. The biggest problem is it has a huge impact on performance. Most everything in Corona is OpenGL accelerated, and if we open up to modifying images per frame, that will, well, kill performance.

What kinds of bitmap manipulation do you want?

fpassa
User offline. Last seen 2 years 28 weeks ago. Offline
Joined: 17 Sep 2009

Eric,

The bitmap manipulation that I also requested time ago was the ability to:

- change pixel color
- free transformation, like resize or move each corner of the bitmap in a freedom way. That could allow to fake some perspectives views for a 2.5D game.
- image blending, like alpha or multiply blending.
- mask blending
- desaturate, i.e. turn its colors into grayscale
- contrast/bright alteration

Regards,

Flavio
fpassa@gmail.com

s.w.powers
User offline. Last seen 9 years 12 weeks ago. Offline
Joined: 16 Mar 2010

Not to mention it would be nice to just have the ability to modify some images on the fly, not necessarily something that one would do in an fps situation. Perhaps an example would be dynamically build a map made up of tiles. Rather than moving a large number of tiles around the screen, it would just be moving the entire background texture (1 object).

For this I'd need to be able to "drawIntoTexture(srcTexture, destTexture, destX, destY, [{srcX, srcY, srcW, srcH}])". This would draw the src into the dest at the dest coords of destX, destY. Optionally, one could specifcy the srcX, srcY, srcWidth, srcHeight to only draw a subset of the src texture.

Going with the "dynamic map creation" theme, this would allow me to have one source texture that contained all my tiles and one destination texture which represents my max dungeon size.

Thanks,
Scott

anovice
User offline. Last seen 6 years 48 weeks ago. Offline
Joined: 6 Feb 2010

I'm really hoping this would be updated.

Changing pixel information and mask/blending would be incredibly useful.

thesmileman
User offline. Last seen 5 years 4 weeks ago. Offline
Joined: 2 Apr 2010

Once OpenGL ES 2.0 shaders are done in Q3 this will not be as big of an issue. If we can write our own shaders we can write almost any image manipulation. Plus it is incredibly fast. I already have a very nice library of fragment and post processing filters for general image manipulation (blurring, sharpening, blending, etc) and they are very fast.

tszming
User offline. Last seen 9 years 30 weeks ago. Offline
Joined: 3 Mar 2010

Image manipulation (pixel level) would be very useful, any update?

m9415253
User offline. Last seen 6 years 48 weeks ago. Offline
Joined: 26 May 2010

I need this too. Would like to build a super simple drawing app for kids, so I need to be able to implement flood fill...

dnhkng@gmail.com
User offline. Last seen 1 year 42 weeks ago. Offline
Joined: 16 Mar 2010

Would this be available soon?

I would like to modify camera and other images. I would like to convert images into table-based arrays, do some maths etc, and convert back to png or jpegs. I don't need real-time processing, so the Anniversary Photoshop app methods should be OK for me.

Thanks!

gabrielstuff
User offline. Last seen 9 years 10 weeks ago. Offline
Joined: 21 Jan 2011

Thumb up for :
- change pixel color
- free transformation, like resize or move each corner of the bitmap in a freedom way. That could allow to fake some perspectives views for a 2.5D game.
- image blending, like alpha or multiply blending.
- mask blending
- desaturate, i.e. turn its colors into grayscale
- contrast/bright alteration

I also would like to use kind of height map effect and other great stuff like this :)

Well, image manipulation could allow a infinite of new gameplay and graphism.

ptphy11
User offline. Last seen 9 years 8 weeks ago. Offline
Joined: 23 Jan 2011

I would also be able to use this, if only to be able to get the color of a pixel and change it. All of the other options that people have suggested seem reasonably useful too.

paf0
User offline. Last seen 8 years 3 weeks ago. Offline
Joined: 17 Dec 2010

How about just detecting the color of a single pixel in an image?

The rest would be nice to have but detecting the color of a pixel would be a great start.

joemx149
User offline. Last seen 4 years 2 weeks ago. Offline
Joined: 19 Jan 2011

+1, see my request "2d graphics and UI foundation".

pixelrevision
User offline. Last seen 9 years 5 weeks ago. Offline
Joined: 27 Jan 2010

+1 to see this implemented using frame buffer objects.

nhuebner
User offline. Last seen 8 years 43 weeks ago. Offline
Joined: 1 Feb 2011

A way to iterate through pixels for their color code would be useful.

dweezil
User offline. Last seen 2 years 24 weeks ago. Offline
Joined: 23 Sep 2010

drawIntoTexture(srcTexture, destTexture, destX, destY, [{srcX, srcY, srcW, srcH

+1

thesmileman
User offline. Last seen 5 years 4 weeks ago. Offline
Joined: 2 Apr 2010

I hope it won't be a function call for every pixel. That would be slow as crap.

pixelrevision
User offline. Last seen 9 years 5 weeks ago. Offline
Joined: 27 Jan 2010

I would imagine that any kind of manipulation would need to be returned as an array to operate on. opengl makes it pretty easy to get a buffer of the pixels, not sure how easy it is to shove that back into the texture though. I would assume you would prolly end up with something like:
pixelArray = myImage.getPixels()
-- manipulate on r,g,b,a * w *h
myImage.setPixels(pixelArray);
Granted this would be operating directly on the floating point values of a very large array. I have no clue how well lua handles really large loops like that on a mobile device.

I just read this thread a little more carefully, especially Eric's comment.

I almost think this thread could fall into 2 buckets.
1. Flash BitmapData style manipulation to gain performance.
2. Generative drawing.

BitmapData style could be something that could be handled with framebuffer objects. This has a lot of potential of actually INCREASING performance on things like tilemaps, parallax scrolling, and drawing applications. Basically they could be setup just like images, but you are able to draw other textures to the texture and only clear it when you want. Example of something that could really benefit from it would be lime. Another example would be a drawing application where you had a canvas that you wanted to "stamp" sprites onto without it being cleared.

Generative drawing would make more sense as something that could happen up front, like when you prepare your scene. I do think it would be nice to at least have some options to do this, with disclaimers about performance. Would give people a lot of room to create dynamic bitmap art.

Anyhow hope these suggestions help.

nhuebner
User offline. Last seen 8 years 43 weeks ago. Offline
Joined: 1 Feb 2011

+1 to the ability to replace a color within a display object, whether filled by corona by rect colorfill, or filled with an image.

Right now the only way I'm able to accomplish this is to use "bitmask" which is not exactly the easiest and cleanest way to develop that.

Or, perhaps give me an example code of Color Fill that will only fill non-transparent parts (ignore transparent parts). As of now, importing a PNG and filling the object, it fills the entire object.

I think the non-transparent fill would be awesome.

:)

Thanks!

ramis2k
User offline. Last seen 5 years 37 weeks ago. Offline
Joined: 13 Feb 2011

In fact the ability to manipulate images is a key factor in the app I'm planning to develop. I don't need real-time manipulation as I'm processing a picture (as in your Photoshop app).

If it's slow, then leave it at the developer's discretion to either use it or not. Or to find creative ways for using it.

I'm exploring Corona, but I think I'll have to move to a different platform unless we get an update soon on this matter.

nhuebner
User offline. Last seen 8 years 43 weeks ago. Offline
Joined: 1 Feb 2011

Ramis,

The first app idea that I got involves your basic image manipulation.

I just need to fill in a display object with a color, without it filling over the transparent parts. Or I need to replace a color. It's part of a designing app I'm making the involves changing colors of on screen images.

So far the only way to do this is to use the bitmask thing, and that's a hack at best.

I will probably just not be able to work on this app (which I really wanted to make, and it was going to be a really great one too), and just focus on what the boundaries are of their api.

Would be nice if yall could put some of this stuff in, particularly a color replacement one-liner.

.replaceColor({255,255,255}, {255,255,0});

That seems cool right?

ramis2k
User offline. Last seen 5 years 37 weeks ago. Offline
Joined: 13 Feb 2011

Well, this thread seems to be one of the most active in the Feature Requests forum, both in reads and replies.

I guess that means something!

nhuebner
User offline. Last seen 8 years 43 weeks ago. Offline
Joined: 1 Feb 2011

bump

eugene.ryzhov
User offline. Last seen 9 years 2 weeks ago. Offline
Joined: 23 Feb 2011

+1
at lease minimum pixels (colors changing, saving results to file...) will be great to have

eugene.ryzhov
User offline. Last seen 9 years 2 weeks ago. Offline
Joined: 23 Feb 2011

+1
at lease minimum pixels (colors changing, saving results to file...) will be great to have

eugene.ryzhov
User offline. Last seen 9 years 2 weeks ago. Offline
Joined: 23 Feb 2011

+1
at lease minimum pixels (colors changing, saving results to file...) will be great to have

vith
User offline. Last seen 8 years 23 weeks ago. Offline
Joined: 4 Jan 2011

+1 as well.

I've been researching some game frameworks lately and Corona is incredibly crippled due to lack of such basic functionality like:

* bitmap manipulation
* no multitasking support whatsoever
* inability to add any external native code

With some EDK support like it is done in AirPlay 4.4 or at least native code-generation moved to local computer (like in Titanium), we could implement everything else what is missing (push notifications, game center, airprint, airplay, well, almost every iOS feature).

With ease of Lua and great marketing, Corona has a chance to become one of the best game frameworks out there. Right now, developers I know are mostly torn between Titanium for apps (because Corona lacks native UI controls), AirPlay for games (because Corona lacks EDK, bitmap manipulation etc) and Corona for ONLY simple, low budget games.

How about instead of just reworking price models, you just give some power to the people to extend your framework?

m9415253
User offline. Last seen 6 years 48 weeks ago. Offline
Joined: 26 May 2010

I agree with Vith on the EDK, but let's not pollute this thread with that discussion. I've started a new thread on that topic here: http://developer.anscamobile.com/forum/2011/02/23/native-code-extensions-breaking-out-corona-sandbox

carlos m. icaza
User offline. Last seen 7 years 52 weeks ago. Offline
Alumni
Joined: 22 Jun 2009

@vith : need my crutches. my wheelchair and need my "handicap" sticker for my car....

Surely I jest.

http://www.youtube.com/watch?v=UwZF_NO8se0
and
http://www.youtube.com/watch?v=9oiH9lp68YU
and with your own chrome
http://www.youtube.com/watch?v=Mmm3wYh5lYA

Everyone else beats us when it comes to UI. We just make simple thing simpler. Hard to believe.

;-)

C.

vith
User offline. Last seen 8 years 23 weeks ago. Offline
Joined: 4 Jan 2011

@carlos

I've seen it, looks great and is of course one of most needed features as well. Is it in daily builds? Or when is it planned to be released?

But some image transformation is needed as well.
Possibly blending layers solution (colorize, saturate, maybe some other types) would work great here.

When this comes + multi tasking + push notifications + possibly open EDK I would stay a life-long subscriber ;)

Imaginestics
User offline. Last seen 8 years 8 weeks ago. Offline
Joined: 8 Apr 2010

@Carlos,

I too need to perform basic image processing, to inspect images at a pixel level, this type of functionality would be greatly appreciated and used if available. Please consider releasing the photoshop API or some facsimile.

Thanks

PXL artificer
User offline. Last seen 38 weeks 1 day ago. Offline
Joined: 16 Sep 2010

As a first step, a getPixel and setPixel similar to the BitmapData class in Flash would be ok for me

paulallanharrington
User offline. Last seen 3 years 13 weeks ago. Offline
Joined: 14 Jan 2011

@Carlos,

Thanks for peeking in on this thread.

I believe some more flexible (bug free) display object/file manipulation features related to display.save (http://developer.anscamobile.com/reference/index/displaysave) would be a great start.

I believe the issues I am having are more likely related to bug/[case #928]: problem capturing the entire object on iPad and iPhone4 devices when Dynamic Scaling (in config.lua) is enabled.

Best wishes,

Paul Allan Harrington
http://www.pahgroup.com

carlos m. icaza
User offline. Last seen 7 years 52 weeks ago. Offline
Alumni
Joined: 22 Jun 2009

I think bug/[case #928] has been fixed.

c.

paulallanharrington
User offline. Last seen 3 years 13 weeks ago. Offline
Joined: 14 Jan 2011

Carlos, again thanks for staying in touch with all of these threads. And also thanks for all the efforts you are making to improve the Corona SDK. I also appreciate the commitment to increasing the availability of helpful information via new additions to the Corona team such as Jonathon Beebe.

With that said, Case #928, if it has been resolved, the information should be reflected in the current API Reference (http://developer.anscamobile.com/node/2469) with additional information such as which build accomplished the fix.

I know you are working hard to improve the product and I hope we can find more efficient ways to keep the documentation current and easily accessible.

I would love to see a blog posting of your thoughts as to how you envision the Corona community could best maintain a more current and accurate Corona "Wiki".

Again, thanks for keeping in close contact with the Corona user base.

Side Note: I'll work through the issue I thought was related to case #928 and post my results as soon as I can accomplish it.

Sincerely,

Paul Allan Harrington
http://www.pahgroup.com

wouterlockefeer
User offline. Last seen 8 years 45 weeks ago. Offline
Joined: 12 May 2011

I too am in great need of access to pixel data. Sometimes being able to read pixel data can be invaluable to make interesting apps. I discovered Corona this week and was working on two apps using pixel data in JavaScript before. I love Corona so far, but I am currently struggling to find a way to use pixel data to port my apps (which are really fast with the pixel data calculations, but just too slow with animations). The only workaround so far is storing info in files and read that. However, it takes up loads of memory and is incredibly slow.

I would love you so, SO much if you'd release if even the simplest of image data/manipulation APIs. The sooner the better. :)

Thanks for creating such a great product!
~Wouter

tim@totalintegr...
User offline. Last seen 6 years 11 weeks ago. Offline
Joined: 19 Feb 2011

We too, would really benefit from image manipulation. Particularly image cropping and resizing for an app we're looking to do.

Have there been any advancements in this area? I see "Improvements to image saving API" in the high priority section on the road map and was hoping it had been worked on recently. Thanks for any info you can offer us.

GreyJellyLabs
User offline. Last seen 5 years 2 weeks ago. Offline
Joined: 27 Aug 2010

+1, bump etc. One of my app ideas would need this.

djr2cool
User offline. Last seen 8 years 9 weeks ago. Offline
Joined: 7 Jun 2011

+1, had a project idea that I scrapped because of this missing feature.

robdewhurst
User offline. Last seen 1 year 18 weeks ago. Offline
Joined: 3 Jan 2011

All i'd need is to be able to find a pixel's luminosity. something like 'getPixel' would be perfect!

Omnigeek Media
User offline. Last seen 2 weeks 2 days ago. Offline
Joined: 18 Jan 2011

+1 on being able to do pixel drawing/shading

WayneB
User offline. Last seen 5 years 43 weeks ago. Offline
Joined: 17 Mar 2010

Low-Level Image Tools Status (+1 Bump)

For my needs (and perhaps this is elsewhere in the API, but I've missed it), some low-level static image tools would be most helpful (and lucrative):
- crop
- matrix transform apply (aka program-supplied filters)
- ability to operate on individual bit-planes (R, G, B, A)
- bitmap drawing capabilities (can be RGBA, but pixel-direct
data-access r/w)

I have, believe it or not, several business and several scientific applications in the queue that need these services & would prefer to not go iOS native, since I know they'll want Android as a follow on.

One quasi-random thought to extend what someone else said, if clearly denoted as "low-performing" services, then, perhaps just include GD with a Lua wrapper as a core lib and call it done?

My $0.02. Looking forward to whatever of these services make it into the environment.

Gary Duke
User is online Online
Joined: 24 Nov 2011

+ 1

and at the very least

How about just detecting the color of a single pixel in an image?

The rest would be nice to have but detecting the color of a pixel would be a great start.

guruk
User offline. Last seen 1 week 5 days ago. Offline
Joined: 9 Feb 2010

hmmm
LOTS A LOTS OF TALK since monthes.

ANY Results in that?

Someone mentioned Performance... ok.. i can live with it.
It does depend how intense I will use that feature, but for small
things I guess it will be fair enough.

Please do not wait for the PERFECT Solution, than already a new
feature may be more important. Just do whats possible and ever
Developer has his own responsibility if he does use that in his app or not.

chris

rupin.dalvi
User offline. Last seen 8 years 11 weeks ago. Offline
Joined: 5 Jan 2012

+1
This is probably the most in demand request on these forums...

noeguer
User offline. Last seen 3 years 16 weeks ago. Offline
Joined: 23 Dec 2011

+1

pro
User offline. Last seen 6 years 34 weeks ago. Offline
Joined: 23 Mar 2012

+ 1

Any updates?

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.