feat: resolution condition for workflow IF/SWITCH nodes (megapixels, short/long edge)
Adds a "Resolution" condition type filtering assets by image dimensions, useful for isolating low-resolution images for cleanup or selecting high-resolution ones. Three metrics with optional min/max bounds: - Megapixels (width x height / 1e6, fractional values allowed) - Short edge in pixels (LEAST of width/height) - Long edge in pixels (GREATEST of width/height) Short/long edge are orientation-agnostic, so a 4000x3000 landscape and a 3000x4000 portrait are treated identically. Uses the exifImageWidth/ exifImageHeight columns on asset_exif, which the condition queries already join; assets without recorded dimensions never match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f0d8a88c27
commit
b473bfdc5d
4 files changed
+47
-1
No files matched your search
@@ -27,6 +27,7 @@ const conditionTypeLabels: Record<ConditionType, string> = {
|
||||
asset_type: "Asset Type",
|
||||
iso_range: "ISO Range",
|
||||
focal_length: "Focal Length",
|
||||
resolution: "Resolution",
|
||||
rating: "Rating",
|
||||
is_favorited: "Favorited",
|
||||
not_in_album: "Not in Any Album",
|
||||
@@ -192,6 +193,25 @@ function ConditionFields({ condition, onChange }: { condition: ICondition; onCha
|
||||
<Input className="h-7 text-xs w-16" type="number" min={1} max={5} placeholder="Max" value={condition.max ?? ""} onChange={(e) => onChange({ ...condition, max: parseInt(e.target.value) || undefined })} />
|
||||
</div>
|
||||
);
|
||||
case "resolution": {
|
||||
const unit = (condition.metric || "megapixels") === "megapixels" ? "MP" : "px";
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<Select value={condition.metric || "megapixels"} onValueChange={(v) => onChange({ ...condition, metric: v })}>
|
||||
<SelectTrigger className="h-7 text-xs"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="megapixels">Megapixels</SelectItem>
|
||||
<SelectItem value="short_edge">Short Edge (px)</SelectItem>
|
||||
<SelectItem value="long_edge">Long Edge (px)</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="flex items-center gap-2">
|
||||
<Input className="h-7 text-xs" type="number" min={0} step="any" placeholder={`Min ${unit}`} value={condition.min ?? ""} onChange={(e) => onChange({ ...condition, min: e.target.value === "" ? undefined : parseFloat(e.target.value) })} />
|
||||
<Input className="h-7 text-xs" type="number" min={0} step="any" placeholder={`Max ${unit}`} value={condition.max ?? ""} onChange={(e) => onChange({ ...condition, max: e.target.value === "" ? undefined : parseFloat(e.target.value) })} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
case "is_favorited":
|
||||
return (
|
||||
<Select value={condition.value === false ? "false" : "true"} onValueChange={(v) => onChange({ ...condition, value: v === "true" })}>
|
||||
|
||||
Reference in new issue
Block a user