
Pika
Pika 2.2 Image to Video - ComfyUI Native Node Documentation
A node that converts static images to dynamic videos using Pika AI

Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
A node that converts static images to dynamic videos using Pika AI

| Parameter | Type | Default | Description |
|---|---|---|---|
| image | Image | - | Input image to convert to video |
| prompt_text | String | "" | Text prompt describing video motion and content |
| negative_prompt | String | "" | Elements to avoid in the video |
| seed | Integer | 0 | Random seed for generation |
| resolution | Select | ”1080p” | Output video resolution |
| duration | Select | ”5s” | Length of generated video |
| Output | Type | Description |
|---|---|---|
| VIDEO | Video | Generated video |
class PikaImageToVideoV2_2(PikaNodeBase):
"""Pika 2.2 Image to Video Node."""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image": (
IO.IMAGE,
{"tooltip": "The image to convert to video"},
),
**cls.get_base_inputs_types(PikaBodyGenerate22I2vGenerate22I2vPost),
},
"hidden": {
"auth_token": "AUTH_TOKEN_COMFY_ORG",
},
}
DESCRIPTION = "Sends an image and prompt to the Pika API v2.2 to generate a video."
RETURN_TYPES = ("VIDEO",)
def api_call(
self,
image: torch.Tensor,
prompt_text: str,
negative_prompt: str,
seed: int,
resolution: str,
duration: int,
auth_token: Optional[str] = None,
) -> tuple[VideoFromFile]:
"""API call for Pika 2.2 Image to Video."""
# Convert image to BytesIO
image_bytes_io = tensor_to_bytesio(image)
image_bytes_io.seek(0) # Reset stream position
# Prepare file data for multipart upload
pika_files = {"image": ("image.png", image_bytes_io, "image/png")}
# Prepare non-file data using the Pydantic model
pika_request_data = PikaBodyGenerate22I2vGenerate22I2vPost(
promptText=prompt_text,
negativePrompt=negative_prompt,
seed=seed,
resolution=resolution,
duration=duration,
)
initial_operation = SynchronousOperation(
endpoint=ApiEndpoint(
path=PATH_IMAGE_TO_VIDEO,
method=HttpMethod.POST,
request_model=PikaBodyGenerate22I2vGenerate22I2vPost,
response_model=PikaGenerateResponse,
),
request=pika_request_data,
files=pika_files,
content_type="multipart/form-data",
auth_token=auth_token,
)
return self.execute_task(initial_operation, auth_token)
Was this page helpful?