MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / applyInlineFilter

Function applyInlineFilter

ui/media/js/main.js:936–978  ·  view source on GitHub ↗
(filterName, path, filterParams, img, statusText, tools)

Source from the content-addressed store, hash-verified

934}
935
936function applyInlineFilter(filterName, path, filterParams, img, statusText, tools) {
937 const filterReq = {
938 image: img.src,
939 filter: filterName,
940 model_paths: {},
941 filter_params: filterParams,
942 output_format: outputFormatField.value,
943 output_quality: parseInt(outputQualityField.value),
944 output_lossless: outputLosslessField.checked,
945 }
946 filterReq.model_paths[filterName] = path
947
948 if (saveToDiskField.checked && diskPathField.value.trim() !== "") {
949 filterReq.save_to_disk_path = diskPathField.value.trim()
950 }
951
952 tools.spinnerStatus.innerText = statusText
953 tools.spinner.classList.remove("displayNone")
954
955 SD.filter(filterReq, (e) => {
956 if (e.status === "succeeded") {
957 let prevImg = img.src
958 img.src = e.output[0]
959 tools.spinner.classList.add("displayNone")
960
961 if (prevImg.length > 0) {
962 tools.undoBuffer.push(prevImg)
963 tools.redoBuffer = []
964
965 if (tools.undoBuffer.length > MAX_IMG_UNDO_ENTRIES) {
966 let n = tools.undoBuffer.length
967 tools.undoBuffer.splice(0, n - MAX_IMG_UNDO_ENTRIES)
968 }
969
970 tools.undoButton.classList.remove("displayNone")
971 tools.redoButton.classList.add("displayNone")
972 }
973 } else if (e.status == "failed") {
974 alert("Error running upscale: " + e.detail)
975 tools.spinner.classList.add("displayNone")
976 }
977 })
978}
979
980function moveImageBetweenBuffers(img, fromBuffer, toBuffer, fromButton, toButton) {
981 if (fromBuffer.length === 0) {

Callers 2

onUpscaleClickFunction · 0.85
onFixFacesClickFunction · 0.85

Calls 3

alertFunction · 0.85
pushMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected