Jump to content
Robert Cailliau

macros do not keep formulae

Recommended Posts

I need to resize hundreds of photos for publishing on the web, and they come in different aspect ratios, portrait/landscape and from different cameras.

I created a macro from Document→Resize Document… , checked Resample, opened the padlock, and typed the formula /2 (divide the number of pixels by 2) in both the width and height fields.

That should reduce the image to a quarter of the pixels.

But no: it calculates the half width and height of the current image, remembers those values and then applies them to any image it is told to work on!

And therefore also the macro canot be applied twice: it does not reduce by half, it reduces to a fixed value which is the same the second time.

 

(1) it would be excellent if the formula would be stored in the macro instead of the result on a particular image

 

(2) is there another way to do it that I have overlooked? (obviously I could first sort the photos into all the portrait ones from a specific camera, then all the landscape ones, and so on for each camera, but then I might as well do it by hand!)

 

(3) is there a way to see what a macro step does?  It seems impossible to see what an "atomic" step such as resize document has actually recorded.


Robert

(Affinity Designer—Affinity Photo—LiveCode—Mac OS X various)

Share this post


Link to post
Share on other sites

Hi Robert,

Unfortunately when you use expressions in those field it calculates them on the spot, so these will never get saved. I did request a while back that it would be advantageous to allow these formulas in the Batch dialog.

Have you tried using/experimenting with the Batch dialog to do this? Obviously you would still have to separate the images, but you can do this when adding them to the list. You can then set the size you want for the export, as well as select any macros you want to run on the images. This will save you from the hassle of manually opening each image, selecting and running the macro and then resaving/exporting.

 

To see what a macro does display the Library Panel (View > Studios > Library) and then you can right click a Macro and select 'Edit Macro'. It will then display each step of the macro in the Macro Panel.

Share this post


Link to post
Share on other sites

Thanks Sean P.

I did the right-click thing before, but nothing at all happens. (I get the choices delete/rename/edit, but edit has no effect whatever)

 

Unless I'm mistaken, Photoshop did allow correct resizing.  But CS6 no longer works on Sierra.

 

Keeping the formula surely is not a big deal, and would be so much more powerful.

 

I will try your batch dialog suggestion.


Robert

(Affinity Designer—Affinity Photo—LiveCode—Mac OS X various)

Share this post


Link to post
Share on other sites

Hi Robert

You can use Filters > Distort > Equations to reduce your image to half its width and height

Just use the settings shown in my screenshot

After that step, use Document > Clip Canvas to get rid of the transparent areas

You can record the above steps in a macro and when replayed it will half the width and height of any size image you give it.

Then just run the macro in conjunction with the batch facilities in Affinity Photo on your hundreds of photographs

 

 

equations.jpg


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be concerned about.

Share this post


Link to post
Share on other sites
3 hours ago, carl123 said:

Hi Robert

You can use Filters > Distort > Equations to reduce your image to half its width and height … …

 

That seems to work.  There must be something going on, even if not a resamplig, because the size of the file in bytes is certainly reduced, and the number of pixels too.

However, I would never have thought of looking in "distort"!

I'll try and report results.


Robert

(Affinity Designer—Affinity Photo—LiveCode—Mac OS X various)

Share this post


Link to post
Share on other sites
15 minutes ago, owenr said:

 

Your image will be resampled, of course, otherwise it could not become a different size, but I meant that you will not be able to choose from the resampling filters that are in the Export command's dialogue.

 

 

 

You set them in the File > New Batch Job dialogue box settings


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be concerned about.

Share this post


Link to post
Share on other sites
1 hour ago, Robert Cailliau said:

However, I would never have thought of looking in "distort"!

I have a feeling that the Distort Equations filter is more useful than it initially looks but there is very little written about it as regards the different things it can do and the formulas you can use.


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be concerned about.

Share this post


Link to post
Share on other sites
7 minutes ago, owenr said:

 

Are you saying that the choice of resampling filter in the export format controls of a batch job is going to influence the resampling done by Distort Equations filter?

 

Nope, that would be silly

But suppose you place a photo on a 1000 x 500px transparent document.  Then decide to reduce the picture to 500 x 250px by dragging on one of the corner handles then do a clip canvas, you cant control the sampling method then either, so what's the difference to that and the Distort Equations Filter method?


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be concerned about.

Share this post


Link to post
Share on other sites

carl123:  (and owenr)

What goes on is that the x*2 and y*2 push the image into a quarter of the space, upper-left of the canvas, but does not change the canvas, i.e. that keeps its number of pixels.

The canvas clip then removes the empty pixels.

I don't yet understand why x*2 halves: I would have thought that a pixel at x,y would now go to x*2,y*2, but it is probably this way around:

f(x)=x*2 means that at position x will now be displayed the pixel that was on x*2 in the original picture.


Anyway, there is also resampling:  obviously I immediately tried x*2 on this image with 1 pixel wide  black lines inserted:

5a0f032f86187_A2017-11-17at16_35_01.thumb.jpeg.3dce010ec420d36db478c6e18612a727.jpeg

 

and then got this:

 

5a0f0354e3f78_A2017-11-17at16_35_29.thumb.jpeg.15aeb8faf70a4922213ae02d32fe2697.jpeg

 

Also, since the equation macro obvioulsy does have to keep the equation, I can apply it more than once if needed.

So that does what I want.

But what a way to do it!

Thanks for the distort tip.

 

(btw, in computing there is a lot of bad use of the word "filter":  a filter's primary purpose is to remove something, usually from a liquid or a gas.  Many of the effects listed in the filters menu are actually transformations. This bad use is much more pronounced in computer programming.  I'm not even going to go into the semantic abuse of definition and resolution, where resolution has replaced definition and "pixel density" has then been invented to mean resolution)

 


Robert

(Affinity Designer—Affinity Photo—LiveCode—Mac OS X various)

Share this post


Link to post
Share on other sites

Hmmm...

There clearly is a resampling algorithm at work, just as in the case of carl123's dragging the corner handle, but we don't know what it is or how to control it.

It would be good to have that settable in the preferences.

The preferences have a lot that I'd like to add, e.g. a way to say how large I want the default size of a new window.


Robert

(Affinity Designer—Affinity Photo—LiveCode—Mac OS X various)

Share this post


Link to post
Share on other sites

Sorry, it's fast approaching beer time over here and I still have things to do first, so as long as the OP is happy with the solution, then so am I


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be concerned about.

Share this post


Link to post
Share on other sites

Ah, well…  owenr,

Now you've just provoked me into my usual rant about "computer science".  The best way to know the details is to look in the code.  There should be no such thing as experiments: the algorithm was written by someone and that someone has the answer.  However, as with all commercial software, that is usually not openly available.

The best thing would be for someone from Affinity/Serif to tell us what it is and what the purpose is.

Agreed that I myself did an experiment, and also agreed that yours show circumstances under which the result is what I was "afraid" of.

The next step should be to get Affinity/Serif to do something about it.  At this late hour of the day (23:26) I can only think of three proposals:

(1)  either put a well-defined resampling algorithm into the equation transform, but that should probably NOT be done, (various good reasons)

(2) provide a sensible way to reduce image sizes while keeping aspect,

(3) keep the formulae specification in the macros.

The ball is in their camp now.


Robert

(Affinity Designer—Affinity Photo—LiveCode—Mac OS X various)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.