Package: pypalex
PyPalExPython Palette ExtractorPyPalEx is a tool for extracting color palettes from images and generating a JSON format file with light and dark color themes. This tool is intended to be OS independent, for use by the tech community for developing their own custom theme managers or by artists who want to extract color palettes for their art from images, pictures or wallpapers they adore.TABLE OF CONTENTSPyPalEx ArchivesWiki HomepagePalette Examples ArchiveCode DocumentationDependenciesEnvironment VariablesInstallationPIP InstallManual/Git InstallUser GuideDisclosureOptions ListNotesExample UsageFeedbackPYPALEX ARCHIVES[Wiki Homepage]
  [Palette Examples Archive]
  [Codebase Documentation]DEPENDENCIESAside from Python, the rest are Python packages that are installable with pip.Python 3.6+Pillow (PIL) 9.0+For performing operations on images.NumPy 1.21+To manage large amounts of image data.filetype 1.0+To confirm filetypes are images file types.ENVIRONMENT VARIABLESThere are two optional environement variables that can be set by the user:PYPALEX_CACHE_DIRPYPALEX_CONFIG_DIRBy default, PyPalEx will try to store extracted color palettes into one of three locations:PYPALEX_CONFIG_DIRXDG_CONFIG_HOME/palex$HOME/.config/palexBy default, PyPalEx will try to save extracted color palettes whereverPYPALEX_CONFIG_DIRpoints to in the user's system. If the user does not set thePYPALEX_CONFIG_DIRenvironment variable, then PyPalEx will default to saving extracted color palettes whereverXDG_CONFIG_HOME/palexpoints to in the user's system. And if theXDG_CONFIG_HOMEenvironment variable is not set, then PyPalEx will default to saving extracted color palettes into$HOME/.config/palex.This default output location is, of course, overriden if PyPalEx is used with the-o --outputoption.INSTALLATIONPIP INSTALLSystem-wide install (sudo)pip3installpypalexUser install (Nosudo)pip3install--userpypalex# Add local 'pip' to PATH:# (In your .bashrc, .zshrc etc)exportPATH="${PATH}:${HOME}/.local/bin/"MANUAL/GIT INSTALLgitclonehttps://github.com/AlTimofeyev/pypalexcdpypalex
pip3install--user.# Add local 'pip' to PATH:# (In your .bashrc, .zshrc etc)exportPATH="${PATH}:${HOME}/.local/bin/"USER GUIDEDISCLOSUREPyPalEx can only work on images that are in the RBG color space, so any images that you supply to PyPalEx that are not already in RGB will automatically be converted into RGB color space before the extraction process begins.PyPalEx takes about ~5 seconds on average to process an image and extract color palettes.When using PyPalEx on a directory of images, you can calculate the time it takes to process all the images by multiplying the number of images by 5 seconds.Example: You have a directory of 20 images. So the time it will take to process all the images is20 x 5 = ~100 secondsSome images may take 2-3 seconds to be processed while other images may take 4-5 seconds to be processed. But the average wait time for an image to be processed and for color palettes to be extracted is about ~5 seconds.OPTIONS LIST-f --filesSpecify the absolute file path(s).If used with-p --pathoption, you only need to specify the relative file path(s).-p --pathSpecify the path from where to use images.Absolute path is preferred, but relative path can also be used.-o --outputSpecify the output path where to store the JSON color palette.--save-checkAsks if the user wants to save the extracted color palettes.--previewShows a preview of the extracted color palettes before saving.--preview-checkShows a preview of, and asks if the user wants to save, the extracted color palettes.--pastelConverts all color palettes into pastel.--pastel-lightConverts light color palette into pastel.--pastel-normalConverts normal color palette into pastel.--pastel-darkConverts dark color palette into pastel.--sat_prefGives preference to more saturated colors of all color palettes.--sat_pref-lightGives preference to more saturated colors of the light color palette.--sat_pref-normalGives preference to more saturated colors of the normal color palette.--sat_pref-darkGives preference to more saturated colors of the dark color palette.-v --versionPrints the PyPalEx version.NOTESWhen using PyPalEx, the use of either-f --filesand/or-p --pathis aMUST. Without either, or both of, these two options being specified, PyPalEx will not work.PyPalEx will skip over any files that are not images.Please note that all the--pasteland--sat_prefoptions only affect the 6 base colors (red, green, yellow, blue, magenta, cyan) and doNOTaffect the background, foreground, black, and white colors.Please note that the user can individually select which palette to convert to pastel (do not mistake palette for "color scheme/color theme"). For more details, please refer to the PyPalEx wiki homepage to identify which "color scheme/color theme" contains the palette you wish to convert to pastel.EXAMPLE USAGE-f --filesOptionpalex-fpath/to/image/dir/image.jpegpalex-fpath/to/image/dir/image.jpegpath/to/image/dir/image2.PNGThe-f --filesoption can be used with a singular image file or with multiple image files. The user must specify the absolute file path to the image they want to use with PyPalEx. However, if the user is already within the directory where the images are located, then a relative file path is also acceptable.~>cdpath/to
~/path/to>
~/path/to>palex-fimage/dir/image.jpegimage/dir/image2.PNG~>cdpath/to
~/path/to>
~/path/to>palex-fimage/dir/image.jpeg~/path/to>cdimage/dir
~/path/to/image/dir>
~/path/to/image/dir>palex-fimage.JPEGimage2.pngThe above examples are meant to show how a user can navigate to a direcotry with images, or at least relatively close to a directory with images, and then use PyPalEx with the-f --filesoption and relative file path(s).-p --pathOptionpalex-ppath/to/image/dir/palex-ppath/to/-fimage/dir/image.pngpalex-ppath/to/image/dir/-fimage.pngpalex-fimage1.pngimage2.jpgimage3.jpeg-ppath/to/image/dir/The-p --pathoption can be used with a whole directory of images and files or it can be used as a reference point for the-f --filesoption. When the-f --filesoption is used with-p --path, the user does not have to specify the absolute path to the images, just the relative image names/filepath(s). The directory that was provided with-p --pathwill be searched for the image names/filepath(s) specified.-o --outputOptionpalex-fpath/to/image/dir/image.jpeg-opath/to/output/dir/palex-opath/to/output/dir/-ppath/to/image/dir/palex-ppath/to/image/dir/-fimage.png-opath/to/output/dir/palex-fimage1.pngimage2.jpgimage3.jpeg-opath/to/output/dir/-ppath/to/image/dir/The-o --outputoption can be used with both the-f --filesand-p --pathoptions. The sole purpose of the-o --outputoption is to let the user override the default output directory. Please refer toEnvironment Variablesfor details about the default output directory.--save-checkOptionpalex-fpath/to/image/dir/image.jpeg-opath/to/output/dir/--save-checkAsks if the user wants to save the extracted color palettes after the extraction process is completed.--previewOptionpalex-fpath/to/image/dir/image.jpeg-opath/to/output/dir/--previewShows a preview of the extracted color palettes before saving. This option requires that the user's terminal has the capability to show ASCII characters and ANSI colors. A future update may include a GUI variation of this preview option to avoid this issue.--preview-checkOptionpalex-fpath/to/image/dir/image.jpeg-opath/to/output/dir/--preview-checkShows a preview of, and asks if the user wants to save, the extracted color palettes. This option is a combination of the--previewand--save-checkoptions. This option requires that the user's terminal has the capability to show ASCII characters and ANSI colors. A future update may include a GUI variation of this preview option to avoid this issue.--pastelOptionpalex--pastel-fpath/to/image/dir/image.jpeg-opath/to/output/dir/Converts all the extracted color palettes into pastel.--pastel-lightOptionpalex--pastel-light-fpath/to/image/dir/image.jpeg-opath/to/output/dir/Converts light color palette into pastel.--pastel-normalOptionpalex--pastel-normal-fpath/to/image/dir/image.jpeg-opath/to/output/dir/Converts normal color palette into pastel.--pastel-darkOptionpalex--pastel-dark-fpath/to/image/dir/image.jpeg-opath/to/output/dir/Converts dark color palette into pastel.--sat_prefOptionpalex--sat_pref-fpath/to/image/dir/image.jpeg-opath/to/output/dir/Gives preference to more saturated colors of all color palettes during the extraction process.--sat_pref-lightOptionpalex--sat_pref-light-fpath/to/image/dir/image.jpeg-opath/to/output/dir/Gives preference to more saturated colors of the light color palette during the extraction process.--sat_pref-normalOptionpalex--sat_pref-normal-fpath/to/image/dir/image.jpeg-opath/to/output/dir/Gives preference to more saturated colors of the normal color palette during the extraction process.--sat_pref-darkOptionpalex--sat_pref-dark-fpath/to/image/dir/image.jpeg-opath/to/output/dir/Gives preference to more saturated colors of the dark color palette during the extraction process.-v --versionOptionpalex-vpalex--versionThe-v --versionoption is used to print the PyPalEx version number.FEEDBACKAny and all feedback is greatly appreciated and welcomed. On the PyPalEx GitHub repository, there is aDiscussionpost that is available for each Release version of PyPalEx and open to everyone for any comments or feedback on the version of PyPalEx you are using.