Comments (4)
It looks like the selector is not working.
from sd-webui-photopea-embed.
same in v1.3.2
from sd-webui-photopea-embed.
function openImageInPhotopea(originGallery) {
if (typeof originGallery.item === "function") {
originGallery = originGallery.item(0);
}
var imageSizeMatches = true;
const outgoingImg = originGallery.querySelectorAll("img")[0];
goToPhotopeaTab();
// First, check the image size to see if we have matching sizes. If it's bigger, we open it
// as a new document. Otherwise, we just append it to the current document as a new layer.
postMessageToPhotopea(getPhotopeaScriptString(getActiveDocumentSize)).then((response) => {
const activeDocSize = response[0].split(",");
if (outgoingImg.naturalWidth > activeDocSize[0] ||
outgoingImg.naturalHeight > activeDocSize[1]) {
imageSizeMatches = false;
}
blobTob64(outgoingImg.src, (imageData) => {
// Actually open the image, passing `imageSizeMatches` into Photopea's "open as new document" parameter.
postMessageToPhotopea(`app.open("${imageData}", null, ${imageSizeMatches});`, "*")
.then(() => {
if (imageSizeMatches) {
postMessageToPhotopea(`app.activeDocument.activeLayer.rasterize();`, "*");
} else {
postMessageToPhotopea(
`alert("New document created as the image sent is bigger than the active document");`,
"*");
}
});
});
});
}
fixed this issue by edit this function
from sd-webui-photopea-embed.
function openImageInPhotopea(originGallery) { if (typeof originGallery.item === "function") { originGallery = originGallery.item(0); } var imageSizeMatches = true; const outgoingImg = originGallery.querySelectorAll("img")[0]; goToPhotopeaTab(); // First, check the image size to see if we have matching sizes. If it's bigger, we open it // as a new document. Otherwise, we just append it to the current document as a new layer. postMessageToPhotopea(getPhotopeaScriptString(getActiveDocumentSize)).then((response) => { const activeDocSize = response[0].split(","); if (outgoingImg.naturalWidth > activeDocSize[0] || outgoingImg.naturalHeight > activeDocSize[1]) { imageSizeMatches = false; } blobTob64(outgoingImg.src, (imageData) => { // Actually open the image, passing `imageSizeMatches` into Photopea's "open as new document" parameter. postMessageToPhotopea(`app.open("${imageData}", null, ${imageSizeMatches});`, "*") .then(() => { if (imageSizeMatches) { postMessageToPhotopea(`app.activeDocument.activeLayer.rasterize();`, "*"); } else { postMessageToPhotopea( `alert("New document created as the image sent is bigger than the active document");`, "*"); } }); }); }); }
通过编辑此功能修复了此问题
感谢提供解决方法 !
from sd-webui-photopea-embed.
Related Issues (20)
- [BUG] button - send to photopea in txt2img/img2img on vladmandic / automatic WebUi not working anymore HOT 3
- Interface looks wired HOT 4
- [Feature Request]: I hope I can choose to use the local model. HOT 1
- Working window width HOT 3
- Closer to open source, lets do Affinity Photo! HOT 1
- send to inpaint is missing...
- Photopea tab is shrunk to unusable state HOT 7
- [Bug] Not correctly handle layer.typename HOT 1
- cant send to photopea from text2image tab. HOT 2
- no selection in active document HOT 2
- Can't see the layers panel on a zoomed page :-) HOT 2
- Cant' sent to photopea from txt2img tab HOT 1
- Can't normalize the view HOT 1
- "Sent to" buttons are broken HOT 1
- When use the sd multilanguage extension, the photopea [inpaint selection] button doesn't work. HOT 1
- Magic Replace tool HOT 3
- Extension does not move past 'loading' with recent versions of A111 HOT 2
- Remove background in select tab no longer available HOT 2
- Why is there no magic replace option in my photopea
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sd-webui-photopea-embed.