fix: filter scale adjust haze in patch composites
This commit is contained in:
parent
1a60671255
commit
40fa7b1e26
@ -4408,10 +4408,18 @@ export async function POST(request: NextRequest) {
|
|||||||
referenceImages,
|
referenceImages,
|
||||||
scaleAdjustPatchComposite: scaleAdjustPatchReference
|
scaleAdjustPatchComposite: scaleAdjustPatchReference
|
||||||
? {
|
? {
|
||||||
diffCompareBlurPx: 0.8,
|
diffAlphaCutoff:
|
||||||
diffHighThreshold: 42,
|
scaleAdjustPatchReference.structureLockedDraft ? 24 : 8,
|
||||||
diffLowThreshold: 14,
|
diffAlphaMultiplier:
|
||||||
featherMaxPx: 42,
|
scaleAdjustPatchReference.structureLockedDraft ? 2.25 : 3,
|
||||||
|
diffCompareBlurPx:
|
||||||
|
scaleAdjustPatchReference.structureLockedDraft ? 1.2 : 0.8,
|
||||||
|
diffHighThreshold:
|
||||||
|
scaleAdjustPatchReference.structureLockedDraft ? 72 : 42,
|
||||||
|
diffLowThreshold:
|
||||||
|
scaleAdjustPatchReference.structureLockedDraft ? 26 : 14,
|
||||||
|
featherMaxPx:
|
||||||
|
scaleAdjustPatchReference.structureLockedDraft ? 36 : 42,
|
||||||
featherMinPx: 10,
|
featherMinPx: 10,
|
||||||
featherRatio: 0.018,
|
featherRatio: 0.018,
|
||||||
maskMode: "diff",
|
maskMode: "diff",
|
||||||
|
|||||||
@ -58,6 +58,8 @@ export interface CanvasScaleAdjustPatchCompositeConfig {
|
|||||||
workspaceRegion: CanvasLocalEditCompositeRegion;
|
workspaceRegion: CanvasLocalEditCompositeRegion;
|
||||||
regions?: CanvasLocalEditCompositeRegion[];
|
regions?: CanvasLocalEditCompositeRegion[];
|
||||||
maskMode?: "workspace" | "diff";
|
maskMode?: "workspace" | "diff";
|
||||||
|
diffAlphaCutoff?: number;
|
||||||
|
diffAlphaMultiplier?: number;
|
||||||
diffLowThreshold?: number;
|
diffLowThreshold?: number;
|
||||||
diffHighThreshold?: number;
|
diffHighThreshold?: number;
|
||||||
diffCompareBlurPx?: number;
|
diffCompareBlurPx?: number;
|
||||||
@ -405,6 +407,14 @@ function normalizeScaleAdjustPatchCompositeConfig(
|
|||||||
workspaceRegion,
|
workspaceRegion,
|
||||||
...(regions.length > 0 ? { regions } : {}),
|
...(regions.length > 0 ? { regions } : {}),
|
||||||
maskMode: value.maskMode === "diff" ? "diff" : "workspace",
|
maskMode: value.maskMode === "diff" ? "diff" : "workspace",
|
||||||
|
diffAlphaCutoff: normalizeOptionalNumber(value.diffAlphaCutoff, {
|
||||||
|
max: 96,
|
||||||
|
min: 0,
|
||||||
|
}),
|
||||||
|
diffAlphaMultiplier: normalizeOptionalNumber(value.diffAlphaMultiplier, {
|
||||||
|
max: 6,
|
||||||
|
min: 0.5,
|
||||||
|
}),
|
||||||
diffHighThreshold: normalizeOptionalNumber(value.diffHighThreshold, {
|
diffHighThreshold: normalizeOptionalNumber(value.diffHighThreshold, {
|
||||||
max: 120,
|
max: 120,
|
||||||
min: 1,
|
min: 1,
|
||||||
@ -2961,8 +2971,12 @@ async function applyScaleAdjustPatchCompositeToImages(params: {
|
|||||||
regionClipPatchMaskRaw ||
|
regionClipPatchMaskRaw ||
|
||||||
Buffer.alloc(workspaceBox.width * workspaceBox.height, 255)
|
Buffer.alloc(workspaceBox.width * workspaceBox.height, 255)
|
||||||
),
|
),
|
||||||
8,
|
typeof composite.diffAlphaCutoff === "number"
|
||||||
3
|
? composite.diffAlphaCutoff
|
||||||
|
: 8,
|
||||||
|
typeof composite.diffAlphaMultiplier === "number"
|
||||||
|
? composite.diffAlphaMultiplier
|
||||||
|
: 3
|
||||||
),
|
),
|
||||||
height: workspaceBox.height,
|
height: workspaceBox.height,
|
||||||
imageBuffer: resizedGeneratedBuffer,
|
imageBuffer: resizedGeneratedBuffer,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user