-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Preview (image) resolution and SVG support #1772
Comments
I think it's handled how QTextBrowser handles it. |
I don't know and never researched it. 😬 |
I tried changing the resolution in the printer and in the document without success. |
r00tr4v3n - I recently used a PNG in one of my markdown files. I had also created an SVG. So, I inserted the SVG. The PNG/SVG is basically a screen shot with arrows. Everything looked fine, including the arrows. I don't remember the DPI. I created a new SVG at 192 DPI. I inserted that SVG into QOwnNotes. I then added a screen shot to the SVG and inserted that into QOwnNotes. In the preview, the SVG without the screen shot looks like your example. However, the SVG with the screen shot looks decent. Export note as PDF ... and view at 200% ... the SVG without the screen shot looks decent (of course subjective; is not as crisp as the text) and the SVG with the screen shot doesn't look very good. Screen shot of the preview: |
What are you saying? We should scale all images by 200%? |
In my simple view, both of my SVGs in the preview should look the same. Either similar to your screen shot or not. The top one, without an image, is similar to your screen shot. The bottom, with an image, is sharp. My guess is the preview sees the top one as SVG and does what it does to it; however, the preview sees the bottom one and "thinks" image (even though it is an SVG) and displays it as such. And this is the difference in the PDF export. The top one is processed as an SVG, maybe not as nicely as can be, but decent; and the bottom one is processed as an image and thus the result (looking at the non image elements) is not as nice. I am guessing. But - they should look the same in the preview and they don't. |
In regards to the 200%, that was the zoom in the PDF. I was curious to know what each looked like. To my surprise the SVG without the image looked sharper, crisper. The SVG with the image - paying attention to the SVG elements - was not as sharp or as crisp. Thus, the PDF results were the complete opposite of the preview. |
r00tr4v3n The SVGs I had created have width and height set at 100%:
If I changed the values to pixels, say something like this:
The preview looks A LOT better. Exporting to PDF (preview) is still not ideal. Exporting to HTML ... and using wkhtmltopdf (to turn the HTML into a PDF) ... works really well. The SVG looks like SVG (in the wkhtmltopdf created PDF). (Note, without the above change, wkhtmltopdf was unable to process the SVGs; which is discussed here: (wkhtmltopdf/wkhtmltopdf#4486).) |
How did you manage to use an |
@Kvcd12, if you are referring to wkhtmltopdf, Webkit is used there. In our case there is QTextBrowser. |
r00tr4v3n - I was assuming you have access to the SVG file before you insert it into QOwnNotes. I created my own to test this. After I created them, I opened the SVG file in a text editor and edited the width and height. That appeared to fix the QOwnNotes preview issue. And it also fixed the wkhtmltopdf issue. pbek - Understood. |
My SVGs are generated, changing them manually or via a background script is no really a sustainable or long term solution. |
You could "convert" them to inline SVGs and change the sizes there (if that works with QTextBrowser)... |
You mean parsing the SVG source? @Kvcd12 That looks way better! My guess still is the lack of anti-aliasing in QTextBrowser. One would have to get the resolution of the screen and change the size of the image accordingly. BTW: I am trying to build a universal solution for UML and LaTex with some limited formatting settings. JLatexMath is unfortunately buggy in this regard. |
@r00tr4v3n - A huge difference. It looks like SVG vector graphics.
For the preview so you can see the text in relation to the SVG? SVG too small, too big kind of thing? |
When I was looking around for solutions I visited the Qt Bug Tracker. There are a few entries like this: SVG not rendered properly. And the answer is sometimes this: The example SVG does not conform to SVG Tiny 1.2, which is what Qt supports. Use QtWebKit to render full spec SVGs. Thus, if one has fancy or complicated SVG, QTextBrowser probably can't handle it. More info here: https://doc.qt.io/qt-5/svgrendering.html |
Yes. Reading the SVG file, adding the attributes, showing it as inline image in html. 😁 |
Yes and also to make it an even multiple of the screen resolution.
It doesn't seem to be that easy. Changing the width only changes the outer bounds, not the paths... At least for the UML and formulas it would be easier to fork JLatexMath and fix the resolution. Can I provide the jar via script repository though? GPL2 should allow that at least. |
I think bundling the jar shouldn't be a problem. |
I do not understand this. I am trying to learn. For example, my screen resolution is 1600x1200. So you would make the image 400x300? Thank you. |
This issue is stale because it has been open for 30 days with no activity. |
This issue was closed because it has been inactive for 14 days since being marked as stale. |
How does Qt/QON handle svg files? They seem to be rendered at a specific resolution.
I tried to measure the pixel width of a PDF to insert images at maximum or relative size and it seems to yield 96 dpi.
Would it be possible to increase this number for the preview and export and/or add a native svg support?
The text was updated successfully, but these errors were encountered: