Initial commit

This commit is contained in:
Nasir Anthony Montalvo
2025-11-13 14:48:58 -06:00
committed by GitHub
commit 526096840e
2349 changed files with 19464 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
# download_by_csv
`rake download_by_csv` allows you to download a list of files from a CSV using Wget.
Please ensure you have Wget installed and available on your terminal!
Check by typing `wget --version` in your terminal.
If you need to install on Windows, see [Add more to Git Bash](https://evanwill.github.io/_drafts/notes/gitbash-windows.html).
Requirements:
- wget
Using defaults:
- Create a CSV named "download.csv" with columns "url" (the full link to the objects you want to download) and "filename_new" (optional, the name you want to save/rename the downloaded objects as). Make sure it is UTF-8 (not from Excel).
- Put "download.csv" into the root of this repository (i.e. same place as the Rakefile).
- Open terminal and type `rake download_by_csv`
- Items included in the "download.csv" will be downloaded using wget, renamed, and output in new folder "download/".
The options can be changed by passing arguments with the rake command.
| option | description | default value |
| --- | --- | --- |
| csv_file | the filename of the CSV file used to rename | "download.csv" |
| download_link | the column name that is the full link to the objects you want to download | "url" |
| download_rename | the column name of the new filename for the downloads (optional, if you don't provide one, it will use what ever the url uses) | "filename_new" |
| output_dir | the name of the new folder to download the files | "download/" |
The order follows [:csv_file,:download_link,:download_rename,:output_dir].
For example,
`rake download_by_csv["other_down.csv","item_link","new_name","download_folder"]`

View File

@@ -0,0 +1,44 @@
# generate_derivatives
`rake generate_derivatives`, automates the creation of optimized, small and thumbnail images from all images and PDFs contained in the "objects/" directory in this repository. (Note: Optimization is not supported for Windows users.)
It outputs the derivatives to "objects/small" and "objects/thumbs".
Please ensure you have the requirements installed and available on the commandline before running!
Requirements:
- **ImageMagick**, [download](https://imagemagick.org/script/download.php)
- **Ghostscript**, [download AGPL version](https://www.ghostscript.com/download/gsdnld.html)
The following configuration options are available:
| option | description | default value |
| --- | --- | --- |
| thumbs_size | the dimensions of the generated thumbnail images | 450x |
| small_size | the dimensions of the generated small images | 800x800 |
| density | the pixel density used to generate PDF thumbnails | 300 |
| missing | whether to only generate derivatives that don't already exist | true |
| compress_originals | Optimize the original image files | false |
| input_dir | Input directory | objects |
You can configure any or all of these options by specifying them in the rake command like so:
```
rake generate_derivatives[<thumb_size>,<small_size>,<density>,<missing>,<compress_originals>,<input_dir>]
```
Here's an example of overriding all of the option values:
```
rake generate_derivatives[100x100,300x300,70,false,false,'images']
```
It's also possible to specify individual options that you want to override, leaving the others at their defaults.
For example, if you only wanted to set `density` to `70`, you can do:
```
rake generate_derivatives[,,70]
```
The mini_magick Gem is used to interface with ImageMagick so it supports both current version 7 and legacy versions (which are common on Linux).
The image_optim Gem is used to optimize images using the optimization libraries provided by the image_optim_pack Gem.
image_optim_pack does not provide binaries for Windows, so optimization is skipped when using the rake task on Windows.

View File

@@ -0,0 +1,27 @@
# rename_by_csv
This task allows you to rename a batch of files using a spreadsheet.
Using defaults:
- Create a CSV named "rename.csv" with the columns "filename_old" (the exact matching current filename, not including directory) and "filename_new" (the new name you want, not including directory). Make sure it is UTF-8 (not from Excel).
- Put your files into the "objects" folder.
- Put your "rename.csv" into the root of this repository (i.e. same place as the Rakefile).
- Open terminal and type `rake rename_by_csv`
- Items included in the "rename.csv" will be copied, renamed, and output in the new folder "renamed/". (nothing will be deleted!)
The options can be changed by passing arguments with the rake command.
| option | description | default value |
| --- | --- | --- |
| csv_file | the filename of the CSV file used to rename | "rename.csv" |
| filename_current | the column name of the old filename | "filename_old" |
| filename_new | the column name of the new filename | "filename_new" |
| input_dir | the name of the folder containing the files to be renamed | "objects/" |
| output_dir | the name of the new folder to put the renamed files | "renamed/" |
The order follows [:csv_file,:filename_current,:filename_new,:input_dir,:output_dir].
For example,
`rake rename_by_csv["other_rename.csv","old_name","new_name","raw_folder","new_folder"]`

View File

@@ -0,0 +1,21 @@
# rename_lowercase
This task takes a folder of files and copies them to a new folder with all filenames downcased.
Using default:
- Put your files into the "objects/" folder.
- Open terminal and type `rake rename_lowercase`
- All files in "objects/" will be copied, filenames converted to lowercase, and output to a new folder "renamed/". (nothing will be deleted!)
| option | description | default value |
| --- | --- | --- |
| input_dir | the name of the folder containing the files to be renamed | "objects/" |
| output_dir | the name of the new folder to put the renamed files | "renamed/" |
The order follows [:input_dir,:output_dir].
For example,
`rake rename_lowercase["raw_folder","new_folder"]`

View File

@@ -0,0 +1,30 @@
# resize_images
This task resizes all images (.jpeg, .jpg, .png, .tif, or .tiff) in a folder of files within this repository.
It outputs the resized images to a new folder in this repository, with all filenames and extensions lowercased, and optionally converted into another image format.
Requirements:
- **ImageMagick**, [download](https://imagemagick.org/script/download.php)
Using defaults:
- Put all images in the "objects/" folder.
- run `rake resize_images` (images will be same format, resized to 3000 pixel max width and height while preserving aspect ratio)
- All images will be output to "resized/" folder.
The options can be changed by passing arguments with the rake command.
| option | description | default value |
| --- | --- | --- |
| new_size | resizing parameter following [ImageMagick geometry conventions](https://imagemagick.org/script/command-line-processing.php#geometry) | '3000x3000' |
| new_format | optionally change format of the image. Leave blank or provide a valid image extension starting with `.` (".jpg", ".png", ".tif") | false |
| input_dir | folder containing all the images | 'objects' |
| output_dir | folder to output the resized images | 'resized' |
The order follows [:new_size, :new_format, :input_dir, :output_dir].
For example,
`rake resize_images["5000x5000",".jpg","raw_folder","new_folder"]`