Panel image previews - method to modify file URL (imgix)

Hello,
I’m using this Imgix plugin to serve images and it’s working nicely. For some images, I’m doing duotone transformations based on color options the editor chooses in the panel. Now, I’d like the preview images in the panel sections to show these stylized images rather than the original.

I guess I should be able to do that with a page model or a field method plugin that I can use in the query of the section blueprint e.g

image: 
    query: page.duotone //duotone() is a page model function that should return the file with some url parameters added 

or

image: 
    query: page.myimage.toDuotone //toDuotone is a custom field method plugin that should return the file with some url parameters added 

So basically what I need to do is just to stick some parameters to the end of the original image file url. That is the Issue: I don’t know how to manipulate the url and then return a proper file object. I was fiddling around with FileVersion for a bit but it’s a bit over my head. Please help!

As you rightly assume, you need a file object, either a real one or a virtual one. A simple URL doesn’t help. So you either have to store the manipulated file in the page folder or turn it into a virtual file: