Why not just put a white layer the size of the canvas behind the image?
Yes, I mentioned that at one point.
I think the key is to understand what the intended purpose is for vectorization. At the moment, it appears that Stefan wants to duplicate his raster images to such accuracy that I wonder why not just use the original raster.
@D_Gowers when you apply a stack scan, do you not get this?
Left being the traced vector stack, and right being the original raster image.
As for Inkscape version, I had 0.91 ā¦I upgraded just now to 9.2 but still same effect.
@afre the reason I want a vector is because I enjoy the look and feel of them. But no offense ā¦if you look at the colours I got, and how yellow the trace ended up compared to the rich reds and greens in the raster, I really donāt think I am demanding the moon and the stars here I donāt see why it didnāt reproduce them properly in this mode when without stack scans it does ā¦with annoying transparent spots.
Because the transparent spots do not show up where where is missing and it looks awkward and a bit overly light. A black layer does a better job yet darker than should. Iāll do a tutorial on the method I found solves it.
No offense taken. I was just wondering if vectorization is the best solution. An open question: maybe it is or maybe it isnāt. I mean you could get a similar look by manipulating a raster, unless you are willing to go deeper than simple tracing.
As for color shift, I do see the problem and empathize. However, I am not good with colors. I can see the difference between colors but somehow have trouble identifying them, so I have refrained from commenting on the subject.
If the color shift is regional, you could attempt to place shapes on top of the trace to blend and reach your target color. I have done this in the past when in a bind. There are many online tools that can help find the hexes you need.
Well hereās the ātutorial.ā Looks like this is about as good as can be done in the current situation. Hope itās helpful to anyone. Iād like to help you all for helping and joining the group effort
ā¦ Well, the colors arenāt the exact same as in the raster version, if thatās what you mean (though I wouldnāt say they are quite as different as your picture showsā¦ only a little dimmer than the original, which is a typical side effect of quantization).
However, the colors in a trace with the Stack option on are completely identical to the ones in a trace with the Stack option off ā ie. the Stack Scans option does not affect colors at all. I can post a comparison if you want.
Checking up on this reminded me that the Preview pane in the Trace dialog should show exactly what colors you are gonna get, since it displays a thumbnail of the āpreprocessedā image (in this case, the image after it has been quantized to N colors). Itās interesting to note that in all frames of your tutorial the thumbnail shown has the reddish tone.
FWIW Iām running inkscape bzr r15625 (ie. trunk, which will eventually become release 0.93)
EDIT: I think I was tracing a different image than you meant though, Iāll retry.
Second try (originally I traced the OP image with your logo etc, now traced the correct tree image):
I see the traced result is displayed yellowish.
This is the actual bug.
The traced result is not yellow when exported!
Traced result as shown in gimp, inkscape, and sxiv
Iām not sure exactly what the cause of this bug is, but it seems pretty clear to me now it is an issue with Inkscapeās display.
@D_Gowers so when you trace it with stack option on in inkscape, the result shows yellow like mine ā¦but after you save the vector and open it in gimp it renders correctly? interesting. I havenāt tried saving it and rendering it, I assumed inkscape would display it right. I will try this at home tonight.
What Iām wondering now is ā¦if one were to exit inkscape then restart it and open the saved vector, would it still show yellow or render right? If you can check before I get home please let me know, otherwise Iāll post results tonight. My version at first was 0.91 but last night I updated to 0.92, no difference in rendering though.
I took another look at the problem at different angles. My computer is incredibly under-powered ā likely more so than yours, so there was a lot of waiting for the CPU/GPU to catch up and screen to refresh.
I tried saving the SVG and opening it again. I get
I also tried exporting the bitmap and traced object, respectively, using āExport PNG Imageā. Takeaways:
-
On my system, exporting doesnāt remove the color shift. Since I donāt trust my eyes, I used a global system color picker to verify. Note the overlaid purple rectangle: I measured the top-left and bottom-right patches inside, comparing raster and vector in app and their exported versions.
-
The color shift isnāt uniform, which makes me suspect that it has to do with issues related to not only posterization but color conversion and management.
-
As @D_Gowers mentioned, Inkscapeās trace tool is based on Potrace. Have you tried using the tool directly? As-is, I donāt believe that Potrace is meant to trace color images.
I forgot to mention how I would deal with the transparency problem. Below is a quick and dirty method. There is some smoothing/dilation, but in my opinion it is an acceptable trade-off for increased color accuracy.
- Select trace
- Object > Ungroup
- Path > Outset
- You may tweak this by using. Preferences > Behavior > Steps
Outset paths by 1px:
PS To make the features less rounded, maybe outset a bit larger than 1px, then inset back to 1px. Again, my computer is super old, so I will let you try it.
thanks for this! good technique to know!
No, I exported a PNG directly from Inkscape, The GIMP and sxiv screenshots were mainly to ascertain that color management wasnāt causing the variation in color.
Iāll re-trace and check the saving thing.
EDIT:
Results are as follows:
- Saving the svg and re-loading into Inkscape makes no difference (still shown yellow)
- Importing SVG into GIMP gives a similar result as exporting from Inkscape (ie. correct colors)
- Importing the exported PNG back into Inkscape shows correct colors.
Like afre, I suspect that this may be related to color management.
Going on that theory, I also took the time to strip the PNG you provided (optipng -strip all 1ebc2a5b146dd249142dd686577b65581b9b7afd.png
). This should remove any color management information (eg. gamma, ICC profile) that could have been influencing things.
Then I imported into Inkscape and traced this file.
Result: Still yellow!
Conclusion: Color management data on input image is not the cause. Bug is triggered by some particular aspect of the pixel data itself. Bug does not affect quantization (otherwise, export would use wrong colors).
Theory: Correct colors are assigned to vectors, then the wrong color management info is assigned to them. Export ignores this CM info (not implemented yet?) and so renders correctly.
However, examining the SVG generated by Inkscape does not reveal any color management information. So Iām still relatively clueless, but at least there is enough evidence in this thread to file a bug report.
@afre: If by āuniformā you mean ādoesnāt occur on all picturesā, I agree.
Last I checked PoTrace didnāt have any multitrace support; anyone who wants to implement it needs to at minimum generate an indexed image, sort its palette by perceptual brightness, and pretend that index == grey value as they repeatedly feed the same image into potrace, varying the --threshold
value.
I havenāt tried the first point but for me the PNG still exhibited incorrect colors.
Color Issues
I rarely use or follow the development of Inkscape anymore, but my impression is that it is fairly color management agnostic. There are a few controls in the GUI but they donāt do anything yet, unless I missed a new development. Stripping the metadata only worsens the situation if proper management exists, unless the metadata is incorrect in the first place. Moreover, PNG color profiling is still uncommon.
I wasnāt referring to the assigning or recognition of metadata but how Inkscape manipulates and handles (āmanagesā) the actual data. Anyway, color is a difficult nut to crack. @Elleās website may help clarify some issues at play, though she focuses on raster processing.
Lastly, feel free to file a bug report, but I feel that we donāt have enough info to warrant proper attention. I suggest you bring this up in places where Inkscape developers are carrying out active conversation. As I donāt see an Inkscape Category on this forum, this might not be the best place to get results
@D_Gowers I will try the exporting myself tonight. Didnāt get around to it yesterday unfortunately. Thanks a lot for the effort!
Well, that is exactly the case I was thinking of. But stripping the metadata also should guarantee an image is imported as plain sRGB, which (eg. in GIMP) often may work out to no transformation at all.
Iām basically just doing the standard debugging thing ā eliminate possibilities.
I put your case down to version differences. Since I donāt completely understand the bug yet, Iām just working on what I can.
ā¦ Thatās not different in a practical sense. If you arenāt using available CMS metadata to manage the image, then there is no guarantee that your pixelwise operations on the image will make any sense.
In any case, my tests were designed to eliminate the possibility that Inkscape was correctly color-managing the image based on wrongly set colorspace information, which AFAICS they did. Itās pretty likely IMO that color management is unrelated to this bug (but at the same time, itās the only guess I have at what could cause it.)
In other words, I am fairly confident that my theory is wrong. But itās still the only theory I have so far
Hope you catch that bug
@D_Gowers i just tested it myself. the Stacks tracing produces the ugly yellow look in Inkscape but once saved it opens well in Gimp. Donāt get it
Well, that makes two of us
Iāve added a comment to this existing bug report that hopefully may prompt some feedback on how to properly track down the cause of this bug.
The only idea I have for that currently is to find another image that causes similar discoloration.
Maybe try it on these.