Batch image processing

New releases and general discussions.

Post » Thu May 13, 2010 1:13 am

***I'm suggesting this unaware of any way to do it in Construct, so please forgive me if this is already possible in the software***

Doing this one-by-one can be very time consuming. For example, I have 150 images that I'm cleaning up the backgrounds of in Construct. Once I'm done I'll have to export all 150 images one-at-a-time into GIMP where I can batch resize/batch crop the images... then I'll have to import them back into Construct.

Now you may ask, why not just do all of that in GIMP? Well, the reason I do it Construct is because it allows me to play the animation and determine which frames I need (or don't need), and allows me to eye-test them in motion which I don't believe can be done in GIMP. Basically, it's always easier to do these things all in one program.

We're already able to batch import images for animations in Construct... so, might batch image editing (batch resizing/batch cropping) and batch image exporting be made an available feature in future versions of Construct?
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Thu May 13, 2010 5:04 am

[url:1y48tirx]http://docs.gimp.org/en/plug-in-playback.html[/url:1y48tirx]

[url:1y48tirx]http://www.gimp.org/tutorials/Basic_Batch/[/url:1y48tirx]

Not sure what you need to do to "clean up" your images, but I'd be willing to bet its doable in Gimp.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Thu May 13, 2010 1:42 pm

Thanks, newt. I had no idea about the GIMP animation previewer.

I already have a GIMP plug-in for batching, though.

But the issue that remains is, in Construct you're able to set the animation speeds separately for each frame and each character, and set it to buttons so you see the movement progressions... it gives us a 100% accurate test since it's in the game. You can't do that in GIMP, so even if you preview each frame in GIMP, it won't be 100% the same in Construct when/if you make mods to the animation frames in Construct.
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Thu May 13, 2010 3:25 pm

Most of my stuff is drawn in another program, but I can see the need for batch processing because of the need for accurate animation testing of your changes. Having to switch back and forth between programs is a bit annoying.

The more you can do all in one program, the better.
B
2
G
2
Posts: 47
Reputation: 744

Post » Thu May 13, 2010 3:59 pm

You can use a canvas and image manipulator to do most of that automatically.

Resize the sprite to whatever you want in the layout editor or at runtime and put a canvas over the sprite. Have an event:

for 1 to 150 (number of frames)
Trigger once
- Sprite: set animation frame to loopindex
- canvas: clear to transparent
- paste sprite to canvas
- send canvas's image to image manipulator using copy from Sprite (works with canvases)
- save as PNG "animation" & loopindex & ".png"

That will save all of the frames to PNGs automatically. Reimport to construct using the import frames feature so you can import them all at once, then open the animation to edit it, alt-click with the hotspot tool to set the hotspot for all the animation frames at once and alt-click crop to crop all the frames at once. Much faster.

While trying to get it right, you might even be able to load all the frames from disk at runtime as well, by for 1 to 150, setting the animation frame of the sprite then loading animation frame from file "animation" & loopindex & ".png", though construct sometimes crashes when using this feature. Also, you need to make sure that a sprite has the number of frames you'd need before trying this at runtime, because you can't create animation frames at runtime.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Thu May 13, 2010 6:50 pm

[quote:3lcgkjqi]But the issue that remains is, in Construct you're able to set the animation speeds separately for each frame and each character, and set it to buttons so you see the movement progressions... it gives us a 100% accurate test since it's in the game. You can't do that in GIMP, so even if you preview each frame in GIMP, it won't be 100% the same in Construct when/if you make mods to the animation frames in Construct.[/quote:3lcgkjqi]

I'd suggest you export the image to gif. You can have two of the same image open, then save one as a gif, and preview it in your favorite image viewer. When its exported Gimp will automatically set the frame rate for you, you can then change the frame speed for each frame by double clicking the layer in the layers window.
Note:
You wont be able to use the gif, but this method will at least let you figure out your speeds.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Thu May 13, 2010 7:02 pm

^^^ In response to the previous two ideas, there seems to always be a way to make something work in this program, it's very versatile. But personally, I would rather something like this be made an option in the image editor rather than using events to get the result. You should be able to highlight all of your frames in the image editor and then select what command you want to apply to those frames, click the command, and then done.

Importing images in a batch in Construct is as simple as clicking 'import frames' and then highlighting all the frames you want, then clicking 'open'. It should be just that simple to batch export, resize, and crop, as well. We're already 50% of the way there since the importing function already allows for batch commands.
B
2
G
2
Posts: 47
Reputation: 744

Post » Thu May 13, 2010 7:54 pm

[quote="RaymondHooks":zcpiw33r]It should be just that simple to batch export, resize, and crop, as well.[/quote:zcpiw33r]

As I mentioned, holding alt and clicking crop will crop all of the frames in an animation.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Thu May 13, 2010 8:18 pm

[quote="Arima":14emqqpd]
As I mentioned, holding alt and clicking crop will crop all of the frames in an animation.[/quote:14emqqpd]

Yes, I know.

The point is that all of it (including batch resize and batch export) should just be a selectable option in the image editor without work-arounds or using events. It should be as simple and readily available as the batch import functions are.
B
2
G
2
Posts: 47
Reputation: 744

Post » Thu May 13, 2010 10:53 pm

This really is image manipulation rather than game making, so seeing how the devs tend to take a minimalist approach (which they should) I doubt you would see something like this even in Construct 2. Plus there are literally hundreds of ways to do this, not to mention what can be done with Python.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests