ComfyUI Extension: AfterDark Film AR Selector
A collection of utility nodes for ComfyUI, including resolution presets for film and photography aspect ratios.
Custom Nodes (0)
README
HackAfterDark Custom Nodes for ComfyUI
Just a few ComfyUI custom nodes that I created for various needs, I hope you find them useful.
AfterDark Film AR Selector
A custom ComfyUI node that provides a dropdown menu of preset resolutions for film and photography aspect ratios. These resolutions are optimized for models with a native resolution of 1024x1024, such as Z-Image Turbo, SDXL, Pony, and Flux.
Preview

Features
- Preset Resolutions: Select from a curated list of common aspect ratios and resolutions.
- Easy to Use: Simply select a preset from the dropdown to output the corresponding width and height.
- Customizable: The list of resolutions can be easily modified in the Python script.
Installation
- Clone or download this repository into your
ComfyUI/custom_nodes/folder. - Restart ComfyUI.
Usage
- Add the "AfterDark Film AR Selector" node to your workflow from the "HackAfterDark" category.
- Select a preset from the dropdown menu.
- The node will output the corresponding width and height, which you can then connect to other nodes in your workflow.
AfterDark Gemini Prompter
A powerful and versatile custom ComfyUI node that connects to the Google Gemini API. It can be used as a sophisticated prompt builder, an image generator, or a multi-modal analysis tool.
Preview

Features
- Dynamic Model Loading: Automatically fetches and displays the latest available Gemini models from the Google API.
- Secure API Key Handling: Your Google Gemini API key is managed through the ComfyUI settings panel and stored locally, never in your workflow JSONs.
- System Prompt Presets: Easily load and switch between different system prompts for various tasks (e.g., Z-Image Turbo prompt generation).
- Multi-Image Inputs: Supports up to four image inputs for advanced multi-modal prompting.
- Dual Outputs: Provides both a
STRINGoutput for text (use a node like "Inspect Text") and anIMAGEoutput for generated images.
Configuration (Required)
To use this node, you must configure it by adding your Google Gemini API key in the ComfyUI settings.
- Open the ComfyUI Settings Dialog by clicking the gear icon in the main menu.
- Find the "HackAfterDark" section.
- Enter your Google Gemini API Key into the "Gemini API Key" field.
- (Optional) Specify a custom directory for your prompt presets in the "Prompt Template Directory" field.
- Restart ComfyUI. The node will automatically load your settings.
System Prompt Presets
This node uses a flexible system for managing system prompts.
- Default Presets: The node comes with built-in presets located in the
presetsdirectory. These are available automatically. - Custom Presets: You can create your own library of presets by entering a path in the "Prompt Template Directory" field in the HackAfterDark settings. The node will then load all
.mdfiles from that directory instead of the default ones.
Each preset file must be a Markdown (.md) file. The filename (without the .md extension) will be used as the name that appears in the dropdown menu. The content of the file is the full text of the system prompt.
Example (Pirate Poet.md):
You are a pirate poet. Respond to all requests in the form of a sea shanty.
Usage
- Add the "AfterDark Gemini Prompter" node to your workflow from the "HackAfterDark" category.
- Select your desired Gemini model from the
modeldropdown. - Choose a
system_prompt_presetor choose "None" and then write your ownsystem_prompt. - Enter your main request in the
user_promptfield. - Connect up to four images to the
imageinputs for multi-modal prompting. - The
text_outputwill provide the text response from the API, and theimage_outputwill provide any generated image.
Troubleshooting
Error: ModuleNotFoundError: No module named 'google.generativeai'
This node requires external Python packages to function. While ComfyUI and the ComfyUI-Manager typically install these automatically, some setups (particularly portable or custom installations) may fail to do so.
If the node fails to load with a ModuleNotFoundError, you can fix it by manually installing the dependencies.
-
Open a terminal or command prompt.
-
Navigate to your ComfyUI installation directory.
-
Run the following command:
path/to/your/python.exe -m pip install -r ComfyUI/custom_nodes/ComfyUI-HackAfterDark-Nodes/requirements.txt ``` *Replace `path/to/your/python.exe` with the actual path to the Python executable that ComfyUI is using. You can usually find this in your ComfyUI startup logs.* -
Restart ComfyUI.
Credits
- Author: HackAfterDark (https://hackafterdark.com)
Follow me on Civitai! https://civitai.com/user/HackAfterDark