Jump to content
How to Install Plugins ×

Liquify


pyrochild

Recommended Posts

Try searching for the Photo Shop mesh file format. This is the format that Liquify uses.

Link to comment
Share on other sites

  • 3 months later...

Recommended this plugin again today. I love it!

I tickled the donate button - hope this is making Pyrochild plenty!

Link to comment
Share on other sites

  • 3 years later...
  • 2 months later...
  • 4 months later...
  • 11 months later...
  • BoltBait pinned this topic
  • 11 months later...

Photoshop has changed the file format of .msh files created in Photoshop's Liquify. The newer .msh files are much smaller (50-300 kB) compared to the original .msh files which were often 15+ MB each. Probably Adobe is just compressing the old files, but I suspect the compression is lossy because of the massive reduction in file size. The old larger files can still be imported in Photoshop but can only be saved in the new smaller format.

 

What this means is that Paint.net's Liquify is now only partly compatible with Photoshop's. Meshes created in Paint.net can be imported into Photoshop, but not the other way around. So I'd like to know: will the plugin be updated to read Photoshop's newer format? And in any case, would anyone be willing to speculate on how the new meshes may be being compressed? That could help any reverse engineering attempts ...

Link to comment
Share on other sites

I don't have Photoshop. Could you attach:

  • A .msh exported from Photoshop
  • Dimensions of the image it was created for
  • Before and after image of the mesh's distortion

Then I can take a look... no promises :)

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

No problem. I made three PNGs of various sizes and used the "push brush" twice in Liquify to make simple test meshes. Dimensions are in the file names. The resulting zip file is too big to attach (still only 1.4 MB), but here's a link to Mega.nz:

https://mega.nz/#!We5QkARI!2-qD_qK2e8ADnYJcT578x9RxXo4uvBH0rXeDPeR-pRU

 

I understand there are no promises when trying to reverse engineer something, but thanks a lot for trying!

 

 

Link to comment
Share on other sites

  • 2 months later...

Hey pyrochild, I assume you didn't manage to crack this since I haven't heard anything. But I'm going to need to look into this myself, so please let me know if you made any progress at all that could give me a head start. For example, any thoughts on what kind of compression Adobe is using to get such large compression ratios (see my previous post)?

 

Link to comment
Share on other sites

  • 3 months later...

Not using paint.net myself (actually making competing app), but since we're all helping each other out. (Yes, it seems new mesh format isn't saving as much data, width/height are smaller than original width/height)

 

 

Last bit of my code:

 

        if (version === 2)
        {
            var width = stream.readUint32();
            var height = stream.readUint32();

            ...

        }

        else    // version === 4
        {
            var width = stream.readUint32();
            var height = stream.readUint32();

            if (width > 32768 || height > 32768) {
                throw new Error("Liquify Mesh File - width or height too large");
            }

            var _unknown0 = stream.readUint32();
            var _unknown1 = stream.readUint32();
            var _unknown2 = stream.readUint32();
            var _unknown3 = stream.readUint32();

            var width2 = stream.readUint32();
            var height2 = stream.readUint32();

            var _unknown4 = stream.readUint32();
            var _unknown5 = stream.readUint32();

            var width3 = stream.readUint32();
            var height3 = stream.readUint32();

            var data = new Float32Array(width*height * 2);

            for (var y = 0; y < height; ++y)
            {
                var x = 0;
                while (x < width)
                {
                    var skip = stream.readUint32();
                    x += skip;
                    if (x >= width) {
                        if (x !== width) {
                            throw new Error("Error in file");
                        }
                        continue;
                    }

                    var offset = (y * width + x) * 2;
                    var count = stream.readUint32();
                    for (var xend = x+count; x < xend; ++x) {
                        data[offset++] = stream.readFloat32() / width;
                        data[offset++] = stream.readFloat32() / height;
                    }
                }
            }
            assert(stream.pos === stream.length);
 

Link to comment
Share on other sites

  • 3 months later...

Wow, thank you so much @Sigurd!

 

So if I'm reading your code right, it seems all Adobe did in the new Liquify file format is to scale down mesh width and height by a factor 4 (each) and implemented a simple compression scheme that skips consecutive zero displacement vectors at the start and end of each line. And to compensate for the lower mesh resolution, displacements are stored as double precision floats instead of single precision. Is that correct?

 

Do you know what width2, height2, width3 and height3 represent? They seem unused in your code.

 

Would you like to share what competing app you're developing? Looks like Javascript so I'm guessing a web app.

 

Great work and thanks again for sharing!

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • 2 months later...

First off, I want to say that this is by far the plugin I've used most for a few years now. Simple and easy to utilize. So thank you for that! 4 quick gripes/suggestions that you're of course welcome to take with a grain of salt:

 -Undo/redo is very slow with larger adjustments

-The entire paint.net application will crash if your brush size is too large (~700px, which is sometimes needed for high resolutions) -- I've lost work to this

-Using the effect near the edge of an image reveals a "wall" against the edge that can't be adjusted

-I frequently find myself wishing I could liquify an image while still being able to see the layers above/below it, too

 

Again, I love all of your work, having made use of it for years now. These are just the wishes/issues I've encountered the most. But hey, it's free! 😛

Edited by thesammy58
Link to comment
Share on other sites

On 10/19/2019 at 7:48 PM, thesammy58 said:

I frequently find myself wishing I could liquify an image while still being able to see the layers above/below it, too

 

Unfortunately, that's currently not possible for plugins that operate in separate windows, as Liquefy does. Plugins don't have access to information from any layers except the active layer. However (as you may or may not already know),  by right-clicking on the image in Liquify, you can select the Clipboard as the background image. This allows you to copy the merged lower layers to the Clipboard (with Ctrl+Shift+C), then use that as the Liquify background image. Not as good as having the other layers visible, but nevertheless very useful.

  • Like 1
  • Upvote 2
Link to comment
Share on other sites

  • 6 months later...
  • 1 year later...
  • 7 months later...
  • 9 months later...
On 1/19/2022 at 7:46 PM, JustHaven said:

Can there be a way to overlay a .png image as a guideline? Kind of like those face warp videos on TikTok?

Doesn't look like it. My solution would be to do the reverse--set your guideline image as the background in Liquify so that you can match the two images up. Ideally you would be able to make the layer you're editing slightly transparent so you can see things better but it doesn't look like layer transparency is taken in to account when using the Liquify editor.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...