fix highres output size
This commit is contained in:
parent
9d3a2d71cb
commit
f7b171f198
|
@ -67,11 +67,12 @@ def stage_highres(
|
||||||
strength=highres.strength,
|
strength=highres.strength,
|
||||||
)
|
)
|
||||||
|
|
||||||
# add highres parameters to the image metadata
|
# add highres parameters to the image metadata and clear upscale stage
|
||||||
chain.stage(
|
chain.stage(
|
||||||
EditMetadataStage(),
|
EditMetadataStage(),
|
||||||
stage.with_args(outscale=1, tile_size=SizeChart.max),
|
stage.with_args(outscale=1, tile_size=SizeChart.max),
|
||||||
highres=highres,
|
highres=highres,
|
||||||
|
upscale=UpscaleParams(upscale.upscale_model, upscale=False),
|
||||||
replace_params=params,
|
replace_params=params,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -202,22 +202,20 @@ class ImageMetadata:
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
# calculate final output size
|
# add optional params
|
||||||
output_size = self.size
|
|
||||||
if self.border is not None:
|
if self.border is not None:
|
||||||
json["border"] = self.border.tojson()
|
json["border"] = self.border.tojson()
|
||||||
output_size = output_size.add_border(self.border)
|
|
||||||
|
|
||||||
if self.highres is not None:
|
if self.highres is not None:
|
||||||
json["highres"] = self.highres.tojson()
|
json["highres"] = self.highres.tojson()
|
||||||
output_size = self.highres.resize(output_size)
|
|
||||||
|
|
||||||
if self.upscale is not None:
|
if self.upscale is not None:
|
||||||
json["upscale"] = self.upscale.tojson()
|
json["upscale"] = self.upscale.tojson()
|
||||||
output_size = self.upscale.resize(output_size)
|
|
||||||
|
|
||||||
json["size"] = output_size.tojson()
|
# calculate final output size
|
||||||
|
json["size"] = self.get_output_size().tojson()
|
||||||
|
|
||||||
|
# hash and add models and networks
|
||||||
if self.inversions is not None:
|
if self.inversions is not None:
|
||||||
for name, weight in self.inversions:
|
for name, weight in self.inversions:
|
||||||
model_hash = self.get_network_hash(server, name, "inversion")[1]
|
model_hash = self.get_network_hash(server, name, "inversion")[1]
|
||||||
|
@ -241,6 +239,19 @@ class ImageMetadata:
|
||||||
|
|
||||||
return json
|
return json
|
||||||
|
|
||||||
|
def get_output_size(self) -> Size:
|
||||||
|
output_size = self.size
|
||||||
|
if self.border is not None:
|
||||||
|
output_size = output_size.add_border(self.border)
|
||||||
|
|
||||||
|
if self.highres is not None:
|
||||||
|
output_size = self.highres.resize(output_size)
|
||||||
|
|
||||||
|
if self.upscale is not None:
|
||||||
|
output_size = self.upscale.resize(output_size)
|
||||||
|
|
||||||
|
return output_size
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_exif(input: str) -> "ImageMetadata":
|
def from_exif(input: str) -> "ImageMetadata":
|
||||||
lines = input.splitlines()
|
lines = input.splitlines()
|
||||||
|
|
Loading…
Reference in New Issue