astro4j icon indicating copy to clipboard operation
astro4j copied to clipboard

Possibility of creating animation from files already created?

Open cytan299 opened this issue 7 months ago • 1 comments

Hi, I'm wondering whether J'Solex has the ability to create animations from png files already created earlier by J'Solex? For example I had collected all the doppler eclipse files and want to create an animation from them in the directory /Volumes/Astro5/astro/15May2025/Sun/doppler. I tried the following script but no animation was created:

[[batch]] img_sz=3392

[tmp] workdir("/Volumes/Astro5/astro/15May2025/Sun") load("doppler", "*.png")

sorted=sort(img:img(0); "date") cr=crop(img:sorted;width:img_sz;height:img_sz;left:0;top:0) trans=transition( images: cr; steps:5; unit:"ipm" )

[outputs] anim=anim(cr;50)

P.S. I found that loadMany() doesn't seem to exist.

The files in the doppler directory are in this format:

10_00_53_20250515_doppler-eclipse.png 10_08_56_20250515_doppler-eclipse.png 10_19_03_20250515_doppler-eclipse.png

Thanks!

cytan

cytan299 avatar May 16 '25 12:05 cytan299

Sure you can do this. There's no loadMany function, it's load_many: https://melix.github.io/astro4j/latest/en/imagemath.html#_load_many

You will not be able to use transition, though, for 2 reasons:

  1. you are using PNG files, which are color files, and transition doesn't work with color images
  2. you are using PNG files, and these do NOT contain metadata like timestamps. In general you should prefer FITS file for working later with them. This also means that the sort function will not be able to do its job either (but given that you have timestamps in file names, you should be able to sort by file name).

Last but not least there's something strange in your script. You are saying you are working with previously processed files, but you are using the [[batch]] section, which will only be executed in a batch processing. Therefore, you should simply use a standalone script and remove the [[batch]].

melix avatar May 16 '25 13:05 melix

Thanks for the info. I rewrote the script so that it works now and generates the animation from all the files in my doppler directory. Here's the code:

# Create an animation from previously reconstructed images. # output is in standalone/processed

[params]

img_sz=3392

[tmp] workdir("/Volumes/Astro5/astro/15May2025/Sun") f=load_many("doppler", ".*.png")

cr=crop(img:f;width:img_sz;height:img_sz;left:0;top:0)

[outputs] anim=anim(cr;100)

I could've sworn that on your page at https://melix.github.io/astro4j/latest/en/jsolex.html the function was loadMany().

Thanks again for taking a look at what I did.

cytan

cytan299 avatar May 17 '25 03:05 cytan299