Skip to content
Snippets Groups Projects
Select Git revision
  • 735f831ae769dc8d08122d0f17a9953768db7b84
  • annotation-on-video default protected
  • demo_ci
  • 3-upstream-01022023
  • master
  • gh3538-captions
  • 16-adapt-for-images-annot
  • 15-api-for-annotations-on-video
  • 15-annotations-on-videos
  • video_for_annotations
  • wip-1-annotations-on-videos
  • 9-videoviewer-tests
  • 9_wip_videotests
  • 6-fix-tests-and-ci
  • _fix_ci
  • wip-webpack-from-git
16 results

webpack.config.js

Blame
  • cropImages.sh 846 B
    #!/bin/bash
    
    # Check if the directory is provided as an argument
    if [ -z "$1" ]; then
      echo "Usage: $0 <directory>"
      exit 1
    fi
    
    # Get the directory from the first argument
    DIRECTORY=$1
    
    # Check if the provided argument is a directory
    if [ ! -d "$DIRECTORY" ]; then
      echo "Error: $DIRECTORY is not a valid directory."
      exit 1
    fi
    
    # Recursively iterate over files in the directory
    find "$DIRECTORY" -type f | while read -r filepath; do
      # Check if the file is an image
      file_type=$(file --mime-type -b "$filepath")
      if [[ $file_type == image/* ]] || [[ "$filepath" == *.gif ]]; then
        # Apply the magick convert command with -trim and -fuzz options
        magick convert "$filepath" -fuzz 10% -trim +repage "$filepath"
        echo "Processed: $filepath"
      else
        echo "Skipped (not an image): $filepath"
      fi
    done
    
    echo "All files processed."