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

Imported images are uglified in Synfig (compared to Gimp) #933

Closed
BarbzYHOOL opened this issue Aug 23, 2019 · 18 comments
Closed

Imported images are uglified in Synfig (compared to Gimp) #933

BarbzYHOOL opened this issue Aug 23, 2019 · 18 comments
Assignees
Projects

Comments

@BarbzYHOOL
Copy link

@BarbzYHOOL BarbzYHOOL commented Aug 23, 2019

Synfig version & platform:
(we're more likely to help if you're using latest development builds)
ubuntu
1.2.1

Issue description:
When I import any image (like png) into Synfig, it looks really UGLY, while in Gimp it looks perfect.
For example, I added some wind effect to a text and in gimp it's clean, but in Synfig it is a bit blurry and the wind effect is much longer/stronger.

It is very confusing. If I render the image from Synfig, it is still ugly when I import it back into Gimp.

So synfig uglifies my images :(

I will post an example tomorrow if required

@Jose-Moreno

This comment has been minimized.

Copy link

@Jose-Moreno Jose-Moreno commented Aug 23, 2019

@BarbzYHOOL Hi. I'm not a developer but It is always best to post a screenshot to serve as visual aid for the developers to understand what your issue is.

Of course It's one thing that it looks "ugly" in editor, and a very different problem that it looks the same when exporting a final movie or image, so let's start by that.

First, please try to export the single PNG file from Synfig. If the result has the appropriate quality demonstrated in GIMP, then please make a comment mentioning this.

Please also try a second export test using the latest release for Ubuntu that can be run using appimages and downloaded from this link:
https://github.com/synfig/synfig/releases/tag/v1.3.11

For a guide on how to run appimages please read this: https://itsfoss.com/use-appimage-linux/

From what you described originally it seems that the image is being shown with a lower resolution, hence "ugly".

Synfig has a switch that lowers the resolution of images being shown, similar to After Effects and this is only meant to reduce the computer processing power when handling multiple images in motion.

image

To lift this restriction on the latest versions make sure you change:

  1. Rendering Mode to Final
  2. Disable the "Low Res" button
    image

Do note however that doing this will make your computer work really hard to display the full quality of your pictures. As such It is advised that you work with the low resolution switch in draft or preview mode when doing complex work.

If after trying this your issue does not improve. Then by all means post the results of these tests so a developer can adequately review your issue and look for a fix. Good luck!

@libreartist

This comment has been minimized.

Copy link

@libreartist libreartist commented Aug 23, 2019

Hi, all! Also I would like to quote from several learning resources that any vector graphics would support only 8 bits for each channel. In RGB, it gives 256 values of Red, 256 of blue and 256 of green. 256 x 256 x256 = 16777216 = 16.7 million colour values. But, problem arises when we edit raster images (with probably effects applied) in more than 8-bits (8bpc) per channel (like 10bpc or 1 billion colours. If we import such high bit depth images into vector programs like Synfig, programs would resample the images into 8bpc for their own operational sake. (I could be wrong. Please, correct me, if Synfig could support more than 8bpc. I haven't attempted such import yet.)

@BarbzYHOOL

This comment has been minimized.

Copy link
Author

@BarbzYHOOL BarbzYHOOL commented Aug 23, 2019

Ok, thank you for trying to help me but I tried all of this before (first post)

This is not about the low res preview (I just tried, it was never enabled and if I enable it it becomes blurry as expected). It wasn't well worded but : If I render the image from Synfig, it is still ugly when I import it back into Gimp., I already "rendered" the png from synfig to png and the png looks bad when opened in an image viewer or inside Gimp. So the quality has deteriorated notably.

Ok so I identified that in fact, it only occurs when my .png has transparency, so for example a layer with text that is on a transparent background. If instead I put that text on a black background and I import it into synfig, then it looks fine. But if I import the same text on transparent background, and I also import a black background separately, then it looks bad.

Here are some tests:

http://image.noelshack.com/fichiers/2019/34/5/1566591882-perfect.png The text is fused with a white background
http://image.noelshack.com/fichiers/2019/34/5/1566591882-ugly.png The text is on transparent background
http://image.noelshack.com/fichiers/2019/34/5/1566591882-white.png here is a white background

If you import perfect.png in synfig, it's perfect. If you import ugly.png + white.png and you put ugly on top of white, it's ugly.

You can compare both method imported in synfig:
http://image.noelshack.com/fichiers/2019/34/5/1566593449-result.png

In my real image, it's worse but here you can see the difference

@Jose-Moreno

This comment has been minimized.

Copy link

@Jose-Moreno Jose-Moreno commented Aug 23, 2019

@BarbzYHOOL I tested this with the latest version available (1.3.1.1) And the good thing is that I can reproduce the problem you have. That is an important step so these issues get acknowledged 😄

Here's the thing, since PNG's only have one transparency channel meant to be saved as a straight single-channel transparent color, It seems that either GIMP (I also tested Photoshop, same thing happened) is exporting the PNG transparency erroneously or Synfig is not properly reading the transparency channel itself, so instead of reading it as straight, it is reading it as if it was pre-multiplied (or pre-masked)

Here's an image here how the picture is seen in Synfig just side by side with the "perfect" version (top) and the "ugly" version (bottom) with a solid white region layer.

image

And now here's there result of a quick workaround, trying to simulate (though not perfectly) the interpretation without pre-masking operations, as if the alpha was interpreted correctly.

image

To get this result you have to duplicate the transparent layer on top of your original transparent image for the same amount of "passes" or steps that the pre-multiplication happened.

So the more you duplicate it, the more you will "un-multiply" or revert to the pre-masking operation that the PNG is being subject to. Of course this is my understanding of the issue from a compositing background, it is possible the issue lies elsewhere, on the rendering engine or else, but the fact that I could come up with this workaround means it should be related to this and as such it's possible to fix (not easily, but possible)

Note: since we don't have the exact values that synfig is using, stacking layers on top of each other is not ideal because if you stack too many, it will make the anti-alias lose transparency and worse. Of course, this should be done by Synfig and not by the user!

I'll attach a SIFZ file with those images so the developers can review the file and I hope it helps you to se see what i did to work around the problem, however this is for sure a REAL problem we shouldn't have in the application, so hopefully this issue stays open and assigned to be fixed eventually. 🙏

Edit: I forgot to attach the images to the Zip, that has been fixed.
Straight_Premultiply_PNG_Transparency_Issue.zip

@Jose-Moreno

This comment has been minimized.

Copy link

@Jose-Moreno Jose-Moreno commented Aug 23, 2019

@libreartist I suggest you open a separate request for the issue / question you have related to the bpc so it won't be lost and developers can appropriately track the issue. I agree Synfig should eventually support up to 32bpc for High Definition Imaging similar to After Effects 👍

@BarbzYHOOL

This comment has been minimized.

Copy link
Author

@BarbzYHOOL BarbzYHOOL commented Aug 23, 2019

damnit I can't use newer version for now so I won't even get the fix

so I can duplicate lets say twice the text and put it inside a group? I can also fuse the background already but then I can't animate the text alone

@Jose-Moreno

This comment has been minimized.

Copy link

@Jose-Moreno Jose-Moreno commented Aug 23, 2019

@BarbzYHOOL It should theoretically work the same. I just used the latest so devs know it's not a problem of the older version.

Edit: If you see the file i attached it's just the same transparent text duplicated, and the background is a vector region.

You could animate everything normally, then export it as an image sequence and re-import it on top to get the proper transparency.

@BarbzYHOOL

This comment has been minimized.

Copy link
Author

@BarbzYHOOL BarbzYHOOL commented Aug 23, 2019

I can't use latest version, so if they fix it, I can just rejoice :P

I will check the files then (dunno what is a vector region, i suppose it's the rectangle tool).

You could animate everything normally, then export it as an image sequence and re-import it on top to get the proper transparency.

I don't get it

Thank you for the tests and the alternative solution.

@BarbzYHOOL

This comment has been minimized.

Copy link
Author

@BarbzYHOOL BarbzYHOOL commented Aug 25, 2019

In fact, my problem is the opposite on another image, it is too strong so if I add a new pass manually, it just makes it stronger and stronger, so it doesn't solve my issue at all and so I can't use synfig at all with transparent images o_0

@rodolforg

This comment has been minimized.

Copy link
Contributor

@rodolforg rodolforg commented Aug 26, 2019

why can't you use a newer version?

@morevnaproject

This comment has been minimized.

Copy link
Member

@morevnaproject morevnaproject commented Sep 14, 2019

I can confirm the issue on current master, even after fix applied for #796 (commit 23b4d4c).

Interesting thing: it looks correctly when displayed on transparent background (1) and incorrect when mixed with white background (2):
screenshot_008

I have packed all test files into zip for convenience -
test.zip

Also, I discovered that provided PNG image with white background is imported as black -
screenshot_009

I submitted a separate issue about that - #952

@BarbzYHOOL

This comment has been minimized.

Copy link
Author

@BarbzYHOOL BarbzYHOOL commented Sep 25, 2019

I thought I had found a workaround by merging the layers beforehand but there is always a time when you need to animate a layer that has transparency, and then you're screwed up :(

was it present in much older versions?

@morevnaproject morevnaproject self-assigned this Oct 4, 2019
@morevnaproject morevnaproject added this to In Progress in Releases Oct 4, 2019
@morevnaproject

This comment has been minimized.

Copy link
Member

@morevnaproject morevnaproject commented Oct 13, 2019

was it present in much older versions?

Yes, the issue is present in every version of Synfig since the very beginning.

The problem comes from the fact that Synfig applies hardcoded gamma 2.2 to all colors. This problem exists since the beginning of Synfig development, if you are interested you can check this thread dated by 2013 (!). We took decision, that it is good moment to get rid of this behaviour and remove extra gamma conversion.

The issue is fixed now by commit a4bbdd7 (thanks to @blackwarthog!).

screenshot_002

Please note, that you get the issue fixed with new version of Synfig only if you create a new file and import your files there. If you open old files, then the issue will be present (this is required, because gamma parameter affects many other things besides images and thus we need to keep old files look the same).

@morevnaproject

This comment has been minimized.

Copy link
Member

@morevnaproject morevnaproject commented Oct 13, 2019

Attached archive with test files for convenience - test.zip

test-v1.2.sifz - file created in Synfig before the gamma fix (a4bbdd7)
test-v1.4.sifz - file created in Synfig after the gamma fix (a4bbdd7)

@blackwarthog

This comment has been minimized.

Copy link
Collaborator

@blackwarthog blackwarthog commented Oct 13, 2019

@BarbzYHOOL

This comment has been minimized.

Copy link
Author

@BarbzYHOOL BarbzYHOOL commented Oct 13, 2019

ok awesome, so now we should be able to import images with transparency and animate them?

I can't test until I reinstall all my OS (and won't happen tomorrow), so that's why i'm asking

@Jose-Moreno

This comment has been minimized.

Copy link

@Jose-Moreno Jose-Moreno commented Oct 13, 2019

@BarbzYHOOL To test this we probably have to wait for a new release version. Hopefully we can get one before new year's eve.

That or if you're comfortable with software compiling, try out their guide to do just that https://synfig-docs-dev.readthedocs.io/en/latest/common/building.html

@morevnaproject

This comment has been minimized.

Copy link
Member

@morevnaproject morevnaproject commented Feb 7, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Releases
Released
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.