Auto-scale low-res images to replace high-res images.

Have you come up with a good Moho trick? Need help solving an animation problem? Come on in.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Auto-scale low-res images to replace high-res images.

Post by Greenlaw »

I had a situation at work where I needed to replace about 70 images that were too high-res with half-res versions. The problem I ran into was that when I manually replaced the images, they came into my existing rig at half-size and the layers needed to be scaled up 200% to fit the rig properly. At some point, this rig could potentially require hundreds of layers to be replaced so this presented a problem, especially since I might possibly need to go back to the high-res images again.

Lucky for me, I discovered a neat trick that made the replacement process easy.

1. Using Photoshop's Batch command and an Action to scale the images to 50%, save all the character art to a 'half-res' folder. Make sure the files have the same name as the original image files currently used in Moho.
2. Rename the folder Moho is currently pulling the 'high-res' images from. My folder was just called Images, so I changed it to 'high-res Images'
3. Open a copy of your scene file in Moho.
4. Moho will report that an image could not be found. Point Moho to a replacement image in the 'half-res' folder.

As expected, Moho replaced all the 'missing' images with the 'half-res' one. What I did not expect was that Moho also scaled all the images to fit the same space previously occupied by the high-res images. When I checked the scale of the layers, they were still 1:1:1 and not upscaled to 2:2:2.

Apparently, Moho employs some kind of 'auto-fit' when replacing 'missing' files. Lucky for me!

Naturally, this might not be so cool if you wish to replace the images with different images that have different shapes. I haven't tested for this but I'm assuming Moho will probably scale the different images to fit the previous dimensions, which could be all wrong for the new images. That's probably because this feature is meant to replace the original images with the exact same images, not different images.

The 'auto-scale' or 'auto-fit' part I stumbled across is probably an undocumented feature or a fortunate (for me, anyway) bug.

I think if this is intended behavior, it would be cool if Moho gave the user the option to import/replace an image with or without the 'auto-sizing' feature, since re-scaling the images will not always be desirable. (Suggestion already sent to the devs.)

Anyway, I just wanted to mention this trick in case anybody else needed to do this. I hope others will find this trick useful.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Auto-scale low-res images to replace high-res images.

Post by Greenlaw »

Update: DKWRoot let me know about a script he created that can switch between two sets of artwork, lo- and hi-res. You can find it here.

Change Image Resolution Script

I haven't tried it yet but this script sounds like a better workflow if you need to switch back and forth between the resolutions. Can't wait to try it myself. :)
User avatar
TheMinahBird
Posts: 263
Joined: Sat Jul 27, 2013 11:10 pm

Re: Auto-scale low-res images to replace high-res images.

Post by TheMinahBird »

Greenlaw wrote: Tue Jan 24, 2017 1:07 am Update: DKWRoot let me know about a script he created that can switch between two sets of artwork, lo- and hi-res. You can find it here.

Change Image Resolution Script

I haven't tried it yet but this script sounds like a better workflow if you need to switch back and forth between the resolutions. Can't wait to try it myself. :)
Do you think you still have the script?
"Now hatred is by far the longest pleasure; men love in haste but they detest at leisure" - Lord Byron
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Auto-scale low-res images to replace high-res images.

Post by Greenlaw »

I'm sure I don't have it installed for 13.5.5 or 14.1 here at work, but I can check for it in my software archive after I get home tonight. Or I might have it on an old computer.

If I don't have it, here's a tip:

With some animation programs, I like to keep low- and hi-res versions of images in separate folders, and I make sure the file names are identical. Next, I set the animation program to refer to a third set of images in another directory. When I'm ready to switch, I copy the files from the version I need and overwrite the files in the third folder, then reload the project. For example, when I'm ready to render a final pass, I copy the hi-res files to the third folder.

If this is something you need to do often, you can probably make an AutoHotKey script for it.

But hopefully, I'll find DKWRoot's script. If I do, I'll put a new link in the thread for his script. (He said earlier this year that he no longer has his old Moho scripts, but he doesn't mind if they're reposted here by users who still have them.) :D
User avatar
TheMinahBird
Posts: 263
Joined: Sat Jul 27, 2013 11:10 pm

Re: Auto-scale low-res images to replace high-res images.

Post by TheMinahBird »

Thanks so much, I wasn't expecting a reply! 😭

If all else fails I'll try what you said! I just hope my warps don't get messed up though, I'm a goober that only likes to use images in Moho (not really fond of the way strokes are handled in the software 😞)
"Now hatred is by far the longest pleasure; men love in haste but they detest at leisure" - Lord Byron
User avatar
TheMinahBird
Posts: 263
Joined: Sat Jul 27, 2013 11:10 pm

Re: Auto-scale low-res images to replace high-res images.

Post by TheMinahBird »

So I went about it this way! (It's a little trick I found that you shared haha): viewtopic.php?p=209283&hilit=swap+psd#p209283


But sadly upon doing it the rig broke. :( I wonder if it has to do with the fact I went from 4000 x 4000 to 1000 x 1000? Perhaps that is too big of a leap for Moho to rescale?
"Now hatred is by far the longest pleasure; men love in haste but they detest at leisure" - Lord Byron
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Auto-scale low-res images to replace high-res images.

Post by Greenlaw »

Maybe the issue is in using a PSD.

In the past, I preferred to use the free Export To Layers To Files Fast script to split out my layered PSD to individual PNG files, and used those in Moho instead. PNGs are much simpler and can behave more predictably.

This third-party export script is fantastic, by the way. It's not only faster than the native command in Photoshop, but it also features many more useful options!

I like the latest incarnation of layered PSD import for Moho--it's much smarter than what we had in 12.5--but I still fall back to PNGs when I see a problem.
User avatar
TheMinahBird
Posts: 263
Joined: Sat Jul 27, 2013 11:10 pm

Re: Auto-scale low-res images to replace high-res images.

Post by TheMinahBird »

This makes me curious about your process! Do you import PNGs frequently to add on to/update rigs in a similar way that one might use substitutions in Toon Boom? Or is there a more efficient way you do that? Because I agree, PSD files can sometimes act weird in Moho ^^;
"Now hatred is by far the longest pleasure; men love in haste but they detest at leisure" - Lord Byron
User avatar
TheMinahBird
Posts: 263
Joined: Sat Jul 27, 2013 11:10 pm

Re: Auto-scale low-res images to replace high-res images.

Post by TheMinahBird »

Greenlaw wrote: Wed Nov 15, 2023 8:06 pm Maybe the issue is in using a PSD.

In the past, I preferred to use the free Export To Layers To Files Fast script to split out my layered PSD to individual PNG files, and used those in Moho instead. PNGs are much simpler and can behave more predictably.

This third-party export script is fantastic, by the way. It's not only faster than the native command in Photoshop, but it also features many more useful options!

I like the latest incarnation of layered PSD import for Moho--it's much smarter than what we had in 12.5--but I still fall back to PNGs when I see a problem.
Also I did some tests and I believe you're right.

I managed to get the trick to work for the PSD file, it went from 4000 x 4000 to 1000 x 1000, but things in Moho were still very laggy and slow to update. So I figured it was still too big, and shrunk it to 500 x 500.

And STILL Moho was behaving oddly. So, I opened a new file and decided to try something, I added a PNG that was 10500 x 5000 pixels and duplicated it a bunch, then attatched it to a rig. If I did Undo actions or moved it the lag wasn't there. So then I did a much smaller version of this, got some PNGs that were 2000 x 2000 or 1920 x 1080, and just added them into a window.

In that one I did a bunch of random Warps, grouped stuff, duplicated everything a bunch. Then duplicated the bone layer it was all under a bunch too and guess what? No lag still! Nothing! I wonder what gives? You'd think shrinking the PSD would've been enough but I guess the virtue of it being a PSD must be too much for what I'm doing. :|
"Now hatred is by far the longest pleasure; men love in haste but they detest at leisure" - Lord Byron
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Auto-scale low-res images to replace high-res images.

Post by Greenlaw »

TheMinahBird wrote: Thu Nov 16, 2023 2:51 pm I managed to get the trick to work for the PSD file, it went from 4000 x 4000 to 1000 x 1000, but things in Moho were still very laggy and slow to update. So I figured it was still too big, and shrunk it to 500 x 500.
Hm...that sounds odd. I routinely use images that are 2k, and sometimes even 4k, in Moho, and don't see much lag.

Some thoughts: what can slow down Moho are multiple high-res images that are being deformed, either with bones or mesh warping. That's a lot of data to change from frame to frame, and It's one of the reasons I avoid using too many high-res bitmaps this way. But if the high-res bitmap images are layer bound, Moho should perform quickly because no deformation occurs. In Moho, there are other ways to work with bitmaps though.

When I need to animate deforming puppets with bitmap images, I find that a more efficient approach is to make vector art and use the high-res bitmaps as Image Texture effects for the vector strokes and fills. Tip: to make the edges look like they are part of the 'bitmap' image, I use a rough brush stroke with an Image Texture applied.

That's how my Moho animations for Hearts Like Fists, Puss In Boots, All Hail King Julien, and Dawn of the Croods were done, all of which used many high-res bitmaps, and I saw little or no performance issues when animating these puppets.

In general, vector art created inside Moho deforms and renders much more efficiently than raw bitmap images, and Moho makes it fairly easy to dress up vector art to look like it's fully bitmap art.

FYI, another good example is Cartoon Saloon's Puffin Rock on Netflix. My understanding is that the character art for the puppets was created entirely with Moho vectors.
Post Reply