eight04 / image-picka

A Firefox/Chrome extension helping you download images.
MIT License
171 stars 19 forks source link
batch-download chrome-extension firefox-extension icon-color image-picker transform-urls webextension

Image Picka

Github Build

An image picker written in webextensions.

Features

Installation

Firefox

Install from addons.mozilla.org.

Chrome

This extension can be installed on Chrome, but it is not hosted on Chrome Webstore. You have to install the extension manually:

  1. Download the latest release from the release page.
  2. Extract the ZIP file to a folder.
  3. Install the folder as an unpacked extension.

Filename pattern

Filename may contain following ${variable}s:

Some notes for iframe:

Feel free to open an issue to discuss this behavior if you think this is not right.

Use expression in filename

Image Picka evaluate the content inside ${} as simple expressions, by using espression.

Here are some examples:

The expression can access variable methods and global object String, Number, and Math.

Transform URL with regexp

If the site displays a thumbnail image, you can transform the URL to its full size URL with this feature, by defining multiple replace rules in the code box. For example:

# baidu
imgsa\.baidu\.com/.+/(\w+\.\w+)$
imgsrc.baidu.com/forum/pic/item/$1

# discord
[^/]+\.discordapp\.net/external/[^/]+/(https?)/(.+?)\?
${$1}://${decodeURIComponent($2)}

# twitter
pbs\.twimg\.com/media/(.+\.\w+)$
pbs.twimg.com/media/$1:orig

Fetch delay

You can set a delay between each download:

https://i.imgur.com 5
http://example.com 10

Retry on failure

Some sites return an error when getting too much traffic. You can make the extension wait some time and try again by defining retry rules:

# example
example\.com/images/.*
3 5 1

Domain blacklist

There are some sites which we don't need to download images from it. The blacklist allows you to disable "Download Single Image" feature (i.e. drag-n-drop, single-click download, and hover button) in specified domains. For example:

example.com
*.example.com

Note that `.example.comdoesn't matchhttps://example.com/buthttps://sub.domain.example.com/`.*

Escape special characters

To generate valid filenames, the extension escapes following characters into Unicode glyphs:

Character Unicode replacement
/
\
?
\|
<
>
:
"
*
~

This should be fine for most of the time. However, in some very old environments, they may have problems reading unicode filenames. By unchecking "escape into unicode glyphs" option, special charaters would be replaced with a single underscore: _.

Similar addons

Icon color

If you are using a dark theme and the icon color doesn't fit your theme, or the icon is completely transparent, try:

  1. Set svg.context-properties.content.enabled to true in about:config.
  2. If the config doesn't exist (e.g. in Firefox ESR 52), you have to specify a proper color manually.

Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=1377302

Collect images from frames in Firefox < 63

The extension needs webNavigation permission to collect frames information, and it would try to request it when starting batch download.

In some older versions of Firefox, the browser would generate an unexpected error while requesting the permission. You can try to start a batch download by clicking the icon in the browser toolbar to request the permission manually. The browser won't generate the error anymore after the permission is granted.

See more information about this bug: https://github.com/eight04/image-picka/issues/138

Zero width joiner

"Zero width joiner" is a special character that is used in emoji. In some file systems, using ZWJ character in the filename will result to an error.

If you find that the filename includes an emoji and the browser can't save the image, try enabling the "Remove zero width joiner" option.

See also: #175

Illegal filename bug in Firefox 127

There is a bug in Firefox 127 that throws an error when downloading a file with a filename that contains a percentage, spaces, or dot.

See also: #347

Translation

You can help translating the extension by joining Image Picka team on Transifex. If you work on GitHub, you can also send a PR containing messages.json file, which would be pushed to Transifex after merging.

Changelog