You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having some issues using the Roop API with Automatic1111. I suspect I am reading in and/or sending the base64 image to the API incorrectly. When using the Roop API using my code, I seem to get results that are faces with black discoloring on them when a PNG file is used. When a JPG file is used, the images generated look good. When using the WebUI Gradio user interface, PNG and JPGs both work well. This leads me to believe I have poorly implemented the reading in of image files to send as base64 to the API. Any help would be appreciated!
With JPGs fed into API:
With PNGs fed into API:
The area of my code I suspect most is imageToBase64. I suspect that this is working fine for JPGs, but perhaps I am not handling it correctly for PNGs:
function imageToBase64(path) {
// read binary data
const bitmap = fs.readFileSync(path);
// convert binary data to base64 encoded string
return Buffer.from(bitmap).toString('base64');
}
roop = async function(locationOfSourceImage, prompt, neg){
var modelLocation = '/home/ubuntu/SD/stable-diffusion-webui/models/roop/inswapper_128.onnx'
var img_base64 = imageToBase64(locationOfSourceImage)
var args=[img_base64,true,'0',modelLocation,'CodeFormer',1,null,1,'None',false,true]
var payload = {
"prompt": prompt,
"negative_prompt": neg,
"seed": -1,
"sampler_name": "DPM++ 2M Karras",
"steps": 20,
"cfg_scale": 4.5,
"width": 512,
"height": 768,
"restore_faces": true,
//Begin HighResFix
"enable_hr": true,
"denoising_strength": 0.2,
"hr_upscaler": "ESRGAN_4x",
"hr_scale": 1.5,
//End HighResFix
"alwayson_scripts": {"roop":{"args":args}},
"override_settings": {"CLIP_stop_at_last_layers": 2 }
}
//some other code not included here
}
The text was updated successfully, but these errors were encountered:
Hello,
I am having some issues using the Roop API with Automatic1111. I suspect I am reading in and/or sending the base64 image to the API incorrectly. When using the Roop API using my code, I seem to get results that are faces with black discoloring on them when a PNG file is used. When a JPG file is used, the images generated look good. When using the WebUI Gradio user interface, PNG and JPGs both work well. This leads me to believe I have poorly implemented the reading in of image files to send as base64 to the API. Any help would be appreciated!
With JPGs fed into API:
![image](https://private-user-images.githubusercontent.com/116394058/282617162-d44cdaed-f947-47a2-a3e3-03ddee84bdb3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMDE5MzEsIm5iZiI6MTcyNjEwMTYzMSwicGF0aCI6Ii8xMTYzOTQwNTgvMjgyNjE3MTYyLWQ0NGNkYWVkLWY5NDctNDdhMi1hM2UzLTAzZGRlZTg0YmRiMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxMlQwMDQwMzFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mMjZjNDRlZmE4MGJiODZiY2U3ZmZhYzkzYTlmOWFkYTIwYjQyODczOWMxM2FhOTBjYmY3MDgyZjYxMzU3NDZlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.hoQs6UBx80zGhaXRAiqeYXahYn03RaDbUQhT6feIJlI)
With PNGs fed into API:
![image](https://private-user-images.githubusercontent.com/116394058/282617237-14bc8dab-db17-4e4e-9f3e-50591bd1db9c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMDE5MzEsIm5iZiI6MTcyNjEwMTYzMSwicGF0aCI6Ii8xMTYzOTQwNTgvMjgyNjE3MjM3LTE0YmM4ZGFiLWRiMTctNGU0ZS05ZjNlLTUwNTkxYmQxZGI5Yy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxMlQwMDQwMzFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zZWU2MGM4NDNjODMwMWEyNTA5NWRlZjZlYWQzYTZjZTBjM2FlMzUwNzE4Nzk2YmE1MjNkOGI0ZWFmNDAzNjQ4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.lI7iTGR0_WKOBglXVxPif_5tcIOZyYDLj5hlJ0jkgrY)
The area of my code I suspect most is imageToBase64. I suspect that this is working fine for JPGs, but perhaps I am not handling it correctly for PNGs:
The text was updated successfully, but these errors were encountered: