A single image layer to "play" an image sequence!

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Made some progress on the creation of bitmaps from lua. Just research and gathering data. I'm learning about this and hopeful but it's still going to be a real pain in the arse. :)

---------------------------------------
Another feedback question:

How do you guys feel about the BMP format for images?

BMP keeps coming up in all of my research for editing/creating images using lua. Apparently it's been around for ages and is extremely well documented and straight forward format. There are a lot more lua resources geared to that format.

Drawbacks are size. BMPs are larger than other formats. I supoose if I crack this with BMP format... I should be able to convert to PNG or JPG.

p.s. My brain is old, dried up and has a hard crusty shell around it making learning new things very difficult. ;)

-vern
User avatar
patricia3d
Posts: 726
Joined: Thu May 31, 2007 4:38 am
Location: India
Contact:

Post by patricia3d »

I am Nill in LUA. But your idea is great.

Hope this will help you

http://www.tecgraf.puc-rio.br/cd/en/func/client.html
User avatar
Víctor Paredes
Site Admin
Posts: 5658
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post by Víctor Paredes »

heyvern wrote:I am thinking it would be easier/better to somehow "link" image editing to a user definable editing application. For example a tool or preference in a script for AS that saves the path to Photoshop, or Gimp. You click "edit image" in some kind of custom tool button and then the tool script will launch that application and open the image for that frame for editing externally to AS.

Any thoughts? Does this sound like a good option?
I know your idea is better than current workflow on AS, but I think it's not too fancy to open another software to paint each time you want to create a frame. The great thing about drawing directly in AS is that you see your lines animated in real time. Animation has not much sense without having the concept of frames.
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
User avatar
ulrik
Posts: 1087
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

Post by ulrik »

selgin wrote:
heyvern wrote:I am thinking it would be easier/better to somehow "link" image editing to a user definable editing application. For example a tool or preference in a script for AS that saves the path to Photoshop, or Gimp. You click "edit image" in some kind of custom tool button and then the tool script will launch that application and open the image for that frame for editing externally to AS.

Any thoughts? Does this sound like a good option?
I know your idea is better than current workflow on AS, but I think it's not too fancy to open another software to paint each time you want to create a frame. The great thing about drawing directly in AS is that you see your lines animated in real time. Animation has not much sense without having the concept of frames.
I agree with Selgin, I think you have made a great script for image sequencing, it will make it a lot easier than working with switch layers and if you could make it work so you could paint inside AS that would indeed rock. If you want to edit your images outside AS it is already possible with Ryllemans "open in Gimp" script, and it works great and updates the image inside AS with just one key stroke.
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Open in Gimp script? Cool. I guess I missed that one. Thanks for the input.

Selgin, I seriously doubt painting will be "real time". It won't be possible to have interactive real time feedback in AS while painting. The best I could do would be to "fake" the stroke as it's painted using the AS UI scripting and update the image after each stroke. This might actually be a bit "slow" as well. It depends on how fast a file can be opened edited and written back to source. Lua is pretty dang fast so let's hope for the best.

I am about to do some testing of this process by opening an existing image file using lua, copying it exactly, looping through every line and saving it to a new file to see how fast it works. This should simulate the actual end result which is the goal.

The part that will take time is actually parsing the PIXELS and changing them. Figuring out the pixels that get changed and updating that in the image file "matrix". You actually have to parse the pixel data... each pixel and update it's color... makes my head spin. ;).

Another problem is there will be no "undo" possible because of how the images are drawn to the file. I can't imagine how an undo can be incorporated. Maybe 1 undo maybe. If I can somehow store image data in a variable I suppose 1 or maybe 2 undos would be possible. No promises.

I seriously doubt I could include "stylus" variable widths. I have to check the AS script interface to see if it can even access that kind of data. I know the freehand draw tool can use stylus data so hopefully it is in the script interface.

I plan to continue working on this. Even if is a "half assed" solution I suppose it could be useful. If it isn't enough using an external editor would still be an option.

Even some "high end" applications use external editors for embedded content. For example I don't think Adobe Premiere has sophisticated "paint" or "draw" tools in it, so it links to AI or Photoshop for editing.

If I needed to do this type of thing I would want to use the tool I am most comfortable with for painting and editing images. I can see the advantage of doing this directly in AS but I would never be able to include even a fraction of the tools that Photoshop or Gimp has. It is a case of reinventing the wheel.

-vern
User avatar
jahnocli
Posts: 3471
Joined: Fri Oct 29, 2004 2:13 pm
Location: UK

Post by jahnocli »

You asked about the .bmp bitmap format. It has two good things going for it -- it's lossless, and it's very efficient at being compressed down to very small file sizes using zip or rar or whatever. No alpha information, but I guess for what you are doing that is irrelevant.
You can't have everything. Where would you put it?
Dodgy
Posts: 207
Joined: Sat Jan 13, 2007 8:01 pm
Location: Sydney
Contact:

Post by Dodgy »

Nice one Vern... Looks awesome.

I think the redraw stroke plugin will help here, you could use it to redraw on one layer and render that to an image.
User avatar
funksmaname
Posts: 3174
Joined: Tue May 29, 2007 11:31 am
Location: New Zealand

Post by funksmaname »

Hey Vern,
Here's my input...
I really don't need bitmap drawing support - i think using an external file is fine, but where i really see this script shine is for using AS as a stop-motion compositor - you can create image sequences in a folder from photographs or webcam and have a 'stop-motion' layer type!

I dont know if this is actually possible, but is there any chance that when you run the script it creates a key for every image frame? that way you could change the timing per frame... i dont know if it's possible to script particular fkeys to particular images in the sequence - but if you can that would be a great new feature :)
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Post by chucky »

Heyvern.
I think anything you do in this regard can only help.
I've actually been using the old technique of putting the images in one large file as tiles and 'stepping' through them with translation animation. yoiks
I think with the drawing support, I think a basic pencil and eraser would be awesome!!!
Think of it! thumb and block the scene with quick sketch tool, and build the clean vector over the top.
Also can make visual revision notes for fix-ups wicked.
External editing is good too, with a quick update option is available.

The real issue with drawing is the freehand tool.
It just needs the end tapering/capping/cancelling fixed, still no nice solution there.
(although I'm thinking the answer could be in 'a falloff setting' for the line thickness attribute?

Also , the ability to merge shapes that are made of crossing lines.
That way filling freehand shapes wouldn't be such a pain.
Like a stitch through setting or a tool that makes a point on two crossing paths welds them.

Lines that cross should also maintain their own thickness, when two lines cross now, they share their line thickness. What could be done about that?

Hey BTW Vern, thanks for the image sequencer, should be in the app :D
User avatar
uddhava
Posts: 315
Joined: Tue Nov 04, 2008 7:24 pm
Location: American back in Hungary

Post by uddhava »

Thanks Vern,

This is a great time saving script. Much easier than using the switch layer to play back an image sequence. Also you can adjust how many frames an image will play for. I think I will copy and edit a few of them to have them ready for different speeds.
Good luck with creating some raster drawing tools in ASP if it possible and worth he effort for you. Even some simple tools would be very useful.

udd
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Post by chucky »

Hey Vern!
This image sequence script is AWESOME, it's going to save my rump on this job as ASPRO is crapping out rendering mov movie layers under certain unexplained conditions.
One big problem is that the script stops playing for me at 120 images.
The problem is I have over 3000 frames, gulp.
Do you know why, its stopping at 120??

This script might be the only save for me due to the render bug.
:?
gravly
Posts: 43
Joined: Sat Jul 17, 2010 3:03 am

Post by gravly »

thanks from another one of the angry mob Vern.

Comments:

Ticking "render at half dimensions" in the export dialog DOESN'T work only for this image layer - therefore using this option messes the relative dimensions of the image layers.

Ticking "render at half frame rate " DOES work.

I tried to work out what was going on selecting different project frame rates but ASPro is just confusing me on this point. I was trying to work out if your script disregards the project frame rate but .

I think the idea of linking with another app is great since replicating a really decent raster editor in ASPro will not be possible.

You could choose a specific app that is free like GIMP or mypaint, and then its accessible to all.

Actually mypaint allows to draw on transparent canvas which you could overlay onto your ASPro frame for a kind of direct painting effect. Perhaps that's getting a bit fussy. Another thing I have noticed is a mypaint animation project/hack to adapt it for a raster animation workflow. My paint is a fast useful smooth tool for tablet pcs - if in doubt check out the work of David Revoy with this tool.
~Because of what I've done so far, I may be able to jury rig a script to change the "frame rate" at render time for traditional animation in AS, for example changing all the keys to only render every 2 or 4 frames. Not sure but I will give it a shot.
I think this type of "render out" workflow has the most immediate potential for your script. This is exactly what you do in audio apps and it seems to me a really good idea to get this smooth in ASPro. It could really help to build up multi layer scenes and multi character scenes. I am thinking for instance of the famous "Tango" animation, here if you haven't seen it:
http://video.libero.it/app/play/index.h ... 0fc174675c

I guess you lose future flexibility by rendering out but it may be worth it to get ASPro animation capabilities more supercharged...

The render out would have to be to lossless alpha format like png (is bmp alpha capable?) otherwise you would end up with a finished animation with a mixture of qualities and also wouldn't be able to layer

Would love to see this script approach grow along those lines. As far as a scripted raster drawing thing goes I say give it a go but think of it rather as a 'grease pen' to make notes on frames rather than a tool for creating the frames themselves. A grease pen would be GREAT.

Also agree with poster suggesting your script as a tool for StopMo. Too true! A bit like the 'Directory Watch' feature you see in some stop mo programs; your have fresh digital cam frames automatically incorporated. Too cool!
gravly
Posts: 43
Joined: Sat Jul 17, 2010 3:03 am

Post by gravly »

The mypaint animation project looks to be linux specific for now - although those with java packaging experience might be able to get it going in other platforms. Anyway it is just mypaint plus a very simple onion skin dialog and a nice multiple transparent png export.

So all in all it goes really well with the your image script Vern.

Standard mypaint for Win and OSX would probably not be too bad for workflow.

Here it is:
http://popolon.org/gblog2/mypaint-animation

...only problem being it produces images.001.png rather than images.0001.png so I have to have a bash script to fix filenames.

So now I am going to have to see if I can look at your Lua syntax to eliminate that step by going to three digits.

...haven't yet found out whether the 120 image limit is true for me.

The other thing I would like to get talking to ASPro is alchemy. (http://al.chemy.org/) This is another cross platform java drawing prog with some strengths of its own.

If I was in Windows environment with ASPro I would be taking a look at my copy of artrage now to see if I could get that talking to aspro.

fun stuff!
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Post by chucky »

Errr ,
I just realised that Vern is recommending BMPs, is that my problem?
I've been using PNG's as BMP's are soooo hefty.
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Post by chucky »

On this topic, I just stumbled into Rylanders edit image in gimp script.

http://rylanderanimation.se/2008/12/11/ ... e-in-gimp/



Gotta love that one.
Doesn't seem to work in 7 though.... :cry:
Funny ever since the scripting was opened up more, not many scripts seem to be working. What the deal?


On the subject of Gimp,
Does anyone know of a mod to the 'export to anime from photoshop' that could do the same from Gimp or Corel Painter for that matter?
Photoshop is so expensive but many other apps will open PSD's for less or for for free.
I know this isn't on one layer which is an excellent idea, but it's a simple solution I hadn't thought of before even if everyone has. :oops:
Last edited by chucky on Mon Oct 18, 2010 8:26 pm, edited 1 time in total.
Post Reply