Guide 7 - Images, videos

Since version 0.8.9, Perun2 supports detection of two common classes of files: images and videos. It uses a huge database of file formats, so if something is a picture, it will definitely be identified. There are four new variables we can use in expressions.

select images;
select videos;
select recursiveImages;
select recursiveVideos;

These classes have unique attributes. Width and height for both images and videos. Duration only for videos.

open images
  order by width * height desc
  limit 1
with photoshop
move recursiveVideos
  where width = 1920
    and height = 1080
    and duration >= 20 minutes
to 'c:/folder/with/movies'

Special attributes can be also applied generally to files.

delete '*.mp4'
  where duration < 5 seconds

Booleans isImage and isVideo are useful in logic expressions.

hide files
  where not isVideo

The detection algorithm is accurate and reliable. Every single file is opened and checked thoroughly. We have to pay the price - it is visibly slow when thousands of files are involved.

If the performance is important, you should stay with fast but less accurate extension comparisons. The execution takes milliseconds instead of seconds.

select files
  where extension in ('jpeg', 'jpg', 'png')