mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-12-25 00:19:09 +01:00
Merge pull request #907 from ogmaresca/webp-support
Support WEBP image formats
This commit is contained in:
commit
50e4683492
@ -39,7 +39,7 @@ class TaskData(BaseModel):
|
|||||||
|
|
||||||
show_only_filtered_image: bool = False
|
show_only_filtered_image: bool = False
|
||||||
block_nsfw: bool = False
|
block_nsfw: bool = False
|
||||||
output_format: str = "jpeg" # or "png"
|
output_format: str = "jpeg" # or "png" or "webp"
|
||||||
output_quality: int = 75
|
output_quality: int = 75
|
||||||
metadata_output_format: str = "txt" # or "json"
|
metadata_output_format: str = "txt" # or "json"
|
||||||
stream_image_progress: bool = False
|
stream_image_progress: bool = False
|
||||||
|
@ -223,9 +223,10 @@
|
|||||||
<select id="output_format" name="output_format">
|
<select id="output_format" name="output_format">
|
||||||
<option value="jpeg" selected>jpeg</option>
|
<option value="jpeg" selected>jpeg</option>
|
||||||
<option value="png">png</option>
|
<option value="png">png</option>
|
||||||
|
<option value="webp">webp</option>
|
||||||
</select>
|
</select>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr class="pl-5" id="output_quality_row"><td><label for="output_quality">JPEG Quality:</label></td><td>
|
<tr class="pl-5" id="output_quality_row"><td><label for="output_quality">Image Quality:</label></td><td>
|
||||||
<input id="output_quality_slider" name="output_quality" class="editor-slider" value="75" type="range" min="10" max="95"> <input id="output_quality" name="output_quality" size="4" pattern="^[0-9\.]+$" onkeypress="preventNonNumericalInput(event)">
|
<input id="output_quality_slider" name="output_quality" class="editor-slider" value="75" type="range" min="10" max="95"> <input id="output_quality" name="output_quality" size="4" pattern="^[0-9\.]+$" onkeypress="preventNonNumericalInput(event)">
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table></div>
|
</table></div>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const EXT_REGEX = /(?:\.([^.]+))?$/
|
const EXT_REGEX = /(?:\.([^.]+))?$/
|
||||||
const TEXT_EXTENSIONS = ['txt', 'json']
|
const TEXT_EXTENSIONS = ['txt', 'json']
|
||||||
const IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'png', 'bmp', 'tiff', 'tif', 'tga']
|
const IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'png', 'bmp', 'tiff', 'tif', 'tga', 'webp']
|
||||||
|
|
||||||
function parseBoolean(stringValue) {
|
function parseBoolean(stringValue) {
|
||||||
if (typeof stringValue === 'boolean') {
|
if (typeof stringValue === 'boolean') {
|
||||||
|
@ -1127,7 +1127,7 @@ function createFileName(prompt, seed, steps, guidance, outputFormat) {
|
|||||||
// fileName += `${tagString}`
|
// fileName += `${tagString}`
|
||||||
|
|
||||||
// add the file extension
|
// add the file extension
|
||||||
fileName += '.' + (outputFormat === 'png' ? 'png' : 'jpeg')
|
fileName += '.' + outputFormat
|
||||||
|
|
||||||
return fileName
|
return fileName
|
||||||
}
|
}
|
||||||
@ -1303,7 +1303,7 @@ function updateHypernetworkStrengthContainer() {
|
|||||||
hypernetworkModelField.addEventListener('change', updateHypernetworkStrengthContainer)
|
hypernetworkModelField.addEventListener('change', updateHypernetworkStrengthContainer)
|
||||||
updateHypernetworkStrengthContainer()
|
updateHypernetworkStrengthContainer()
|
||||||
|
|
||||||
/********************* JPEG Quality **********************/
|
/********************* JPEG/WEBP Quality **********************/
|
||||||
function updateOutputQuality() {
|
function updateOutputQuality() {
|
||||||
outputQualityField.value = 0 | outputQualitySlider.value
|
outputQualityField.value = 0 | outputQualitySlider.value
|
||||||
outputQualityField.dispatchEvent(new Event("change"))
|
outputQualityField.dispatchEvent(new Event("change"))
|
||||||
@ -1325,10 +1325,10 @@ outputQualityField.addEventListener('input', debounce(updateOutputQualitySlider,
|
|||||||
updateOutputQuality()
|
updateOutputQuality()
|
||||||
|
|
||||||
outputFormatField.addEventListener('change', e => {
|
outputFormatField.addEventListener('change', e => {
|
||||||
if (outputFormatField.value == 'jpeg') {
|
if (outputFormatField.value === 'png') {
|
||||||
outputQualityRow.style.display='table-row'
|
|
||||||
} else {
|
|
||||||
outputQualityRow.style.display='none'
|
outputQualityRow.style.display='none'
|
||||||
|
} else {
|
||||||
|
outputQualityRow.style.display='table-row'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ const PLUGINS = {
|
|||||||
OUTPUTS_FORMATS: new ServiceContainer(
|
OUTPUTS_FORMATS: new ServiceContainer(
|
||||||
function png() { return (reqBody) => new SD.RenderTask(reqBody) }
|
function png() { return (reqBody) => new SD.RenderTask(reqBody) }
|
||||||
, function jpeg() { return (reqBody) => new SD.RenderTask(reqBody) }
|
, function jpeg() { return (reqBody) => new SD.RenderTask(reqBody) }
|
||||||
|
, function webp() { return (reqBody) => new SD.RenderTask(reqBody) }
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
PLUGINS.OUTPUTS_FORMATS.register = function(...args) {
|
PLUGINS.OUTPUTS_FORMATS.register = function(...args) {
|
||||||
|
Loading…
Reference in New Issue
Block a user