Image Manipulation?

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. [import]uid: 6308 topic_id: 894 reply_id: 300894[/import]

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?
[import]uid: 54 topic_id: 894 reply_id: 2146[/import]

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
[import]uid: 3022 topic_id: 894 reply_id: 2149[/import]

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 [import]uid: 5659 topic_id: 894 reply_id: 2158[/import]

I’m really hoping this would be updated.

Changing pixel information and mask/blending would be incredibly useful. [import]uid: 4661 topic_id: 894 reply_id: 4685[/import]

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. [import]uid: 5886 topic_id: 894 reply_id: 4755[/import]

Image manipulation (pixel level) would be very useful, any update?
[import]uid: 5526 topic_id: 894 reply_id: 5050[/import]

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… [import]uid: 6795 topic_id: 894 reply_id: 5310[/import]

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! [import]uid: 5652 topic_id: 894 reply_id: 15086[/import]

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 :slight_smile:

Well, image manipulation could allow a infinite of new gameplay and graphism. [import]uid: 24293 topic_id: 894 reply_id: 17913[/import]

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. [import]uid: 26343 topic_id: 894 reply_id: 18203[/import]

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. [import]uid: 12752 topic_id: 894 reply_id: 18284[/import]

+1, see my request “2d graphics and UI foundation”. [import]uid: 21703 topic_id: 894 reply_id: 18584[/import]

+1 to see this implemented using frame buffer objects. [import]uid: 4555 topic_id: 894 reply_id: 20728[/import]

A way to iterate through pixels for their color code would be useful. [import]uid: 32936 topic_id: 894 reply_id: 22293[/import]

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

+1 [import]uid: 9371 topic_id: 894 reply_id: 22320[/import]

I hope it won’t be a function call for every pixel. That would be slow as crap. [import]uid: 5886 topic_id: 894 reply_id: 22517[/import]

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. [import]uid: 4555 topic_id: 894 reply_id: 22522[/import]

+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.

:slight_smile:

Thanks! [import]uid: 32936 topic_id: 894 reply_id: 22706[/import]

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.

[import]uid: 37667 topic_id: 894 reply_id: 23289[/import]