Giter Site home page Giter Site logo

bragerosberg / image-renamer-clip-trimmer Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 105 KB

Takes a folder of images with chosen extension and renames them in ascending order based on set year.

TypeScript 100.00%
rename-files image archiver optimization nodejs glob albums renames photos tech printer

image-renamer-clip-trimmer's Introduction

File optimazation: image renamer | clip trimmer

Personal scripts I've created to automate repetitive tasks when editing, handling or updating media files like images and movies

TL;DR: Skip renamining countless amount of files manually, cutting out the intro of video clips. Use scripts that automates them tedious jobs for you.

Are you digitalizing your physical albums containing hundreds, or even thousands of photos? Have you downloaded your favorite movie series, but have an intro you always skip? This was my case, and I decided to automate whatever I could to spice up the repetitive process (e.g. naming > thousand copies of scanned physical photos 🤯) It was a lot more exciting to take on the challenge to make this a possibility, and oh boy, it felt good when it worked the way I hoped it could, saving me a lot of time. Where I know gladly will name copies of photos to whatever prefix someone wants.

Use Locally

  • Clone this repository at your desired location
  • cd to /image-renamer-clip-trimmer folder

Add your media

Whether you want to rename images, or trim video clips: take the media assets you want to rename/compress and place it into the /media folder


  • You are ready: Install dependencies and run your desired script npm i Rename images: npm run rename Trim video clip: npm run trim

  • Let the script run, depending on the files you want to update the run time may wary. The updated media assets will be in the same folder /media

Article

Contents

  • Have full control and enhance efficiency by skipping repeating renaming images, trimming multiple videos into a custom length.

Tech Usage and Reasoning

  • Glob - fetch files matching query (images, clips) and then iterate on the result
  • fs from node - rename, unlinkSync

Full Description

Image Renaming

Enter the file renameImage.ts and navigate to the declared variables on line 12 & 13. These are the variables, and their intended usage:

  • fileYear: What year are the files form (e.g. 2021)
  • prefix: What context is the file (e.g. June, Wedding, Christmas)

Running the script, npm run rename, would update a list of randomly named images and convert them into a more structured format (see example below):

CEA_enNO808NO808&oq=uuidasd223.png --> Wedding_2021_0.png
d&aqs=12312S/D..69i57j69i59l2j69.png --> Wedding_2021_1.png
1378j0j1&sourceid=chrome&ie=23.png --> Wedding_2021_2.png

Video trimming

Enter the file trimMP4.ts and navigate to the declared variables on line 15 & 16. These are the variables, and their intended usage:

  • startTime: when do you want the new start time to be (hh:mm:ss) (e.g. 00:00:00)

  • clipDuration: how long do you want the clip to be in seconds (e.g. 30)

Running the script, npm run trim, would update the list of videos added to the /media folder and convert them into clips like the following (see example below):

copyRightFreeClip.mp4 (duration 8:25) --> copyRightFreeClip.mp4 (duration 0:30)
anotherCopyRightFreeClip.mp4 (duration 2:55) --> anotherCopyRightFreeClip.mp4 (duration 0:30)
lastCopyRightFreeClip.mp4 (duration 4:56) --> lastCopyRightFreeClip.mp4 (duration 0:30)

Get in Touch With me

codeSTACKr | LinkedIn codeSTACKr.com gmail

Creator

MIT License Copyright (c) 2021 Brage Røsberg

image-renamer-clip-trimmer's People

Contributors

bragerosberg avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.