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

设置inpainted的格式 #724

Open
tohsakrat opened this issue Jan 12, 2025 · 8 comments
Open

设置inpainted的格式 #724

tohsakrat opened this issue Jan 12, 2025 · 8 comments

Comments

@tohsakrat
Copy link

如题,太占地方了,希望能设置成更jpg或者webp
其实对于漫画来说最节省地方的是png+索引颜色,不过一半要专业的图片处理软件才会内置,所以能退而求其次保存成jpg或者webp就好了

@dmMaze
Copy link
Owner

dmMaze commented Jan 13, 2025

存成有损压缩反复读取保存会造成图像劣化

@minicom365
Copy link
Contributor

How about merging the two files into one by taking advantage of the fact that the mask image is black and white and putting it into the alpha channel of the inpainted image?

@dmMaze
Copy link
Owner

dmMaze commented Jan 14, 2025

How about merging the two files into one by taking advantage of the fact that the mask image is black and white and putting it into the alpha channel of the inpainted image?

I doubt it would save significant space worth the effort. Besides, saving these intermediates as they are is convenient for post-editing.

@minicom365
Copy link
Contributor

Then how about adding the ability to compress intermediate and final images for completed work?

Users will feel uncomfortable about preserving a large-sized project even though the work is completed. If we can dramatically reduce the size of a completed project with lossy compression, I think it will be easy to preserve the project even if there is image loss.

@tohsakrat
Copy link
Author

存成有损压缩反复读取保存会造成图像劣化

能不能每次保存inpainted的时候和mask做一次乘法,这样用不上的像素就是空白的,png保存的时候连续的相同像素可以大大减小文件体积

@minicom365
Copy link
Contributor

能不能每次保存inpainted的时候和mask做一次乘法,这样用不上的像素就是空白的,png保存的时候连续的相同像素可以大大减小文件体积

Currently, when making modifications using inpainting or paint tools, the program attempts to directly edit the inpainted image. As you mentioned, if unused areas are made blank, the program would need to composite the original image with the inpainted image (where unused areas are blanked out) every time a modification is made. Moreover, unless an alpha channel is used, it would be difficult to distinguish between actual black and the blanked-out areas, making implementation challenging.

@tohsakrat
Copy link
Author

能不能每次保存inpainted的时候和mask做一次乘法,这样用不上的像素就是空白的,png保存的时候连续的相同像素可以大大减小文件体积

Currently, when making modifications using inpainting or paint tools, the program attempts to directly edit the inpainted image. As you mentioned, if unused areas are made blank, the program would need to composite the original image with the inpainted image (where unused areas are blanked out) every time a modification is made. Moreover, unless an alpha channel is used, it would be difficult to distinguish between actual black and the blanked-out areas, making implementation challenging.

Hello, considering that generative AI translation is currently cheap and easy to use, I have chosen to use my native language for real-time communication. I hope you don't mind.
不必担心,如果我的理解没错的话:

  1. 当我们在一张图片上工作时,当前的原始图片、mask、inpainted都被加载在内存中。也就是说,工作中的inpainted图片≠被保存的inpainted数据。我们只要在进入这张工作图片的时候,使用inpanted数据+原始图片,合成内存中的inpainted图片,在离开这张图片时将内存中的inpainted图片和mask做乘法保存即可。现在对于result图片也是这样处理的,所以我相信这对作者来说不是很难的事情。如果你需要导出单独的无字图片,可以请求作者增加这个功能,或者自己在ps中合成。
  2. 这和alpha与否无关,a通道和rgb通道在保存方式上没有区别,取什么颜色的像素作为空白像素都不影响png的无损压缩算法能很好地处理连续的相同像素。

@minicom365
Copy link
Contributor

Oh, I think I misunderstood. You mean that if you leave only the valid parts of the mask in the inpaint image and designate the rest as blank, you can later composite only the masked parts with the original image, so there is no problem? If this interpretation is correct, I agree that there is no big difficulty in implementation. Except that the process of obtaining the intermediate result becomes difficult.

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