Skip to content
/ SIR Public

SIR Image Renamer - a tag fetcher extension for Firefox and Chrome

License

Notifications You must be signed in to change notification settings

Brawlence/SIR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SIR

SIR is an Image Renamer extension for Google Chrome and Mozilla Firefox.

codebeat badge CII Best Practices pipeline status coverage report GitHub Releases

Get it from the official stores here: 🦊 Firefox, 🏐 Chrome

Features

  • Customizable naming template
  • Option to bypass 'Save As…' dialog
  • Fetched Tags String preview & copy (with hotkeys!)
  • Pixiv thumbnail warning on save request
  • Pixiv, X (Twitter), Danbooru max quality promoter & navigation prompt on 'View Image…'
  • Automatic handling of long names & multiple artists collaboration

Description

SIR fetches data from popular image galleries, suggesting informative file names through the usual 'Save As…' dialog.

The naming template is customizable; by default it's set to:

{handle}@{OR} {ID} {name} {caption} {tags},

{handle} represents author's nickname (usually it's a part of the gallery link), {OR} is site abbreviation as follows below, {ID} is a platform-unique ID of the picture (if present), {name} is author's human-readable name (often it's not the same as handle!), {caption} is the image title as specified by the creator, {tags} is a string of tags, separated by spaces (in-tag spaces are replaced by underscores).

Additionally, the selected text can be passed on as well with {selection} string.

Supported site OR ('origin') ID type
Artstation AS case-sensitive alphanumeric
Deviantart DA numeric
Drawfriends DF numeric
Hentai-Foundry HF numeric
Instagram IG case-sensitive alphanumeric with underscore
Pixiv PX numeric
Tumblr TU none
X (Twitter) TW none
MedicalWhiskey MW numeric
VidyArt VA numeric
Danbooru DB numeric
TODO: Kemono-Party KP ???
TODO: Gumroad GR ???

The resulting filename is compatible with 0xb8/WiseTagger#1 and can be further tweaked by specifying a custom template through the extension context menu.

Please note:

  • On some sites many or all identifiers could be missing (and thus cannot be fetched).
  • No Unique IDs are known for X (Twitter) and Tumblr. If you do happen to know how to decipher ids for these platforms, please contact me.

Technical details

Every time a new page from the listed domains is loaded, SIR adds to it a content script, which responds for pings from the extension. If the active tab has this script responding, context menu items would be enabled, allowing input.

By user request ("SIR Image Renamer""Download with tags"), content scripts parse the page and pass the info to renaming procedure. This procedure suggests the file downloader a name to save the file by. "Save As" dialogue is invoked depending on whether the Suppress 'Save As' option was selected. By default, the image is saved in your browser's default download directory.

In addition, it is possible to manually get the list of parsed tags by pressing Ctrl+Shift+1 or selecting "Get tags string" in the context menu.

One can see what info is discovered by SIR ("SIR Image Renamer""Highlight fetched tags?"): Example of tag highlighting

For currently shown image or video on Instagram, the extension first promotes it to maximum available quality and then removes (right-click preventing) obstructions. This enables proper behavior not only for SIR, but for all the regular context menu options too (including third-party extensions depending on context menus, ex. Image Search Options!).

When opening single images from twimg.com domain (Twitter hosting server), SIR will prompt you for navigation to their full-sized original counterparts. Additionally, on Pixiv invoking a menu from a thumbnail, queues the download of the full-resolution picture.

Installation

To install and run the latest (non stable) version of this extension, follow these steps:

  • clone (or download the repository and unpack the archive) and place Extension folder in known location
  • for Firefox, navigate to Debug Addons menu (about:debugging#/runtime/this-firefox or Menu→Addons→'Gear' Dropdown→Debug Addons) and click on Load Temporary Add-on…
  • for Chrome, navigate to Extensions menu (chrome://extensions/ or Menu→More tools→Extensions), enable the "Developer Mode" and click on Load Unpacked
  • proceed to the Extension folder, select either the folder itself (for Chrome) or the manifest.json file (for Firefox)

Stable releases are published through the official stores and can be found here:

Firefox: https://addons.mozilla.org/firefox/addon/sir_image_renamer/

Chromium: https://chrome.google.com/webstore/detail/sir-image-renamer/gmdcgijknjodfhggamchhhejamncbgmc

Recommendations

  • SIR is a self-sufficient extension, yet it works wonders in conjunction with WiseTagger.
  • Although a handy tool, it's not (yet?) a batch downloader. You still have to manually save each file.
  • Some authors include no tags whatsoever, others fill way too much useless general-sounding clutter, so if you're aiming for maximum resolution, please check and tweak the name before saving.
  • Overabundant tags can sometimes exceed the filename length limit, thus they will be trimmed to nearest space below 230 symbols.

Planned features (TODO)

  • Customizable template
  • 'Options' page (as page action) to tweak and store persistent user options
  • Download subfolder customization
  • Localisation (…s?)
  • Integration with Hydrus Network for stealing tags (maybe?)
  • Batch downloads (maybe?)

Known bugs

  • Twitter - when scrolling through the infinite view, unrelated tags are fetched (since SIR fetches tags from the whole visible area). Please save images from individual post page for now.
  • Chrome/Chromium-based browsers do not allow setting 'referer' header; thus, on Pixiv, it's not possible to download the image through context menu. Please use Get Tags StringSave As… in the meantime.

If you happen to enconuter an unlisted bug, please submit it through https://github.com/Brawlence/SIR/issues/new