Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Photoshop output is JPG, compressed, and changes the color space #261

Open
Jonseed opened this issue Nov 4, 2024 · 7 comments
Open

Photoshop output is JPG, compressed, and changes the color space #261

Jonseed opened this issue Nov 4, 2024 · 7 comments

Comments

@Jonseed
Copy link

Jonseed commented Nov 4, 2024

I'm new to this Photoshop plugin, but I have experience with Stable Diffusion and ComfyUI. I'm really looking forward to using this plugin, as it will really help my workflow.

I noticed as I began using the plugin a few things:

  • the output from Photoshop is a JPG (even though the file is named PS_canvas.png in the data folder). ExifTool clearly says it is a JPG file:
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
  • this means that it is also compressed, which introduces JPG artifacts. I can see the artifacts when I zoom in close on the image. (ExifTool says it is using Baseline DCT for lossy compression. This is also apparent from the filesize, 33MB -> 2MB.). Going back and forth between ComfyUI and Photoshop will just introduce more and more compression artifacts each transit, so the image will progressively degrade.
  • the original PNG file I brought into Photoshop was in the RGB color space, but when it is output as a JPG from Photoshop, ExifTool says it is being converted to the YCbCr color space commonly used for JPG, with YCbCr4:2:0 sub sampling, which means it reduces the color resolution because it is compressing the color information. This changes the colors.
  • when the image is placed again as a layer in Photoshop, it is sometimes being placed 1 pixel higher or lower vertically than in the original document. This only occurs about half the time, so maybe it is a rounding error?

I think the plugin in Photoshop needs to get the canvas image as a raw lossless untagged PNG image. This would prevent most of these problems I think.

@LiJT
Copy link

LiJT commented Nov 8, 2024

Agree..... For now this plugin produce incredible amount of JPG artifect.... I really wish V2.0 gonna fix it according to Nima

@LiJT
Copy link

LiJT commented Nov 8, 2024

I guess Nima did it for the sake of Speed. I tried sd-ppp plugin with Nima's workflow, combined them together.
Please check this issue
#239

SD-PPP "Get image from Photoshop" Node does NOT have this Quality degradation problem, but it will kept the canvas original size, for most case it is not ideal since I was using SDXL Lightning it will cause problem. So I used Layerstyle "Image scale by aspect Ratio V2" Node to shrink the "Get image from Photoshop" output. During multiple test, I found out that this workflow also not ideal, since it has to do size scale before it fed to Ksampler for img2img...... And it feels Cluncky and not as smooth as before..

This is tricky question, I hope some bright mind has solution to tackle this problem!

@Jonseed
Copy link
Author

Jonseed commented Nov 8, 2024

@LiJT I'm also using SD-PPP instead because of this quality issue. In SD-PPP it is slow if you get the whole canvas of a very large image, but with SD-PPP you can specify the context boundary to get with the "bound" input (just draw a shape the boundaries you want on the selected layer in the Get Layer node), which makes it much faster, like this:

Screenshot 2024-11-08 100349

Looking forward to Nima fixing this quality issue in ComfyUI-Photoshop, because it is easier to get the context area around the selection via the padded crop. I like that workflow better.

@LiJT
Copy link

LiJT commented Nov 8, 2024

@LiJT I'm also using SD-PPP instead because of this quality issue. In SD-PPP it is slow if you get the whole canvas of a very large image, but with SD-PPP you can specify the context boundary to get with the "bound" input (just draw a shape the boundaries you want on the selected layer in the Get Layer node), which makes it much faster, like this:

Screenshot 2024-11-08 100349

Looking forward to Nima fixing this quality issue in ComfyUI-Photoshop, because it is easier to get the context area around the selection via the padded crop. I like that workflow better.

wow this looks intresting, lemme test how fast it now run following ur image build XD

@LiJT
Copy link

LiJT commented Nov 9, 2024

@LiJT I'm also using SD-PPP instead because of this quality issue. In SD-PPP it is slow if you get the whole canvas of a very large image, but with SD-PPP you can specify the context boundary to get with the "bound" input (just draw a shape the boundaries you want on the selected layer in the Get Layer node), which makes it much faster, like this:

Screenshot 2024-11-08 100349

Looking forward to Nima fixing this quality issue in ComfyUI-Photoshop, because it is easier to get the context area around the selection via the padded crop. I like that workflow better.

Thanks man, today I just tried your method, unfortuanate for my prefered resolution 2560x1440... SD-PPP node still is about 3times slower than Nima Method. Even I switch back to SD 1.5 LCM method. The SD-PPP node will take about 1 sec before each loading time, Total generation time is about 2-4 seconds (I dont want sound like a dick but yeah I know it is pretty fast but waaaaay slower than Nima method)
It feels not as smooth Nima which only took 0.02s to load the image, total generation time for SDXL Lightning on my 4090 is about 0.95second for each image.

When Nima is coming back, we miss him dearly

@Jonseed
Copy link
Author

Jonseed commented Nov 9, 2024

It's probably because SD-PPP is getting an uncompressed image, which takes longer to save out to temp folder. JPG is faster, but you lose a lot on quality. Once Nima switches to uncompressed, it will probably be slower too.

@rollingcookies
Copy link

I also noticed that data is not only sent to Photoshop in compressed form, but when it comes from Photoshop it is also in compressed form 🤦‍♂️!
Nima, please remove compression, it really degrades the quality, fuck speed, if the quality is degraded, you can't draw cool pictures :'(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants