-
Notifications
You must be signed in to change notification settings - Fork 14
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
Weird rendering of some SVG images #776
Comments
Thanks for reporting. I can reproduce the issue even with PyQt6 (did not try PySide6 though, but I also do not know if this could possibly make a difference). Vimiv relies on QT to do the rendering of the SVGs. So there is nothing we can do about this. AI, under my directives, has created a MVE that illustrates the issue (scroll using the mouse wheel): import sys
from PyQt6.QtWidgets import QGraphicsView, QGraphicsScene, QApplication
from PyQt6.QtSvgWidgets import QGraphicsSvgItem
from PyQt6.QtGui import QColor, QPainter
SVG_PATH = "./vimiv_problem.svg"
class CustomGraphicsView(QGraphicsView):
def __init__(self):
super().__init__()
self.setRenderHints(
QPainter.RenderHint.Antialiasing | QPainter.RenderHint.SmoothPixmapTransform
)
self.setTransformationAnchor(QGraphicsView.ViewportAnchor.AnchorUnderMouse)
self.setResizeAnchor(QGraphicsView.ViewportAnchor.AnchorUnderMouse)
def wheelEvent(self, event):
zoom_factor = 1.2
if event.angleDelta().y() > 0:
self.scale(zoom_factor, zoom_factor)
else:
self.scale(1 / zoom_factor, 1 / zoom_factor)
def display_svg_image(file_path):
app = QApplication(sys.argv)
view = CustomGraphicsView()
scene = QGraphicsScene()
scene.setBackgroundBrush(QColor("darkgray"))
svg_item = QGraphicsSvgItem(file_path)
scene.addItem(svg_item)
view.setScene(scene)
view.show()
sys.exit(app.exec())
if __name__ == "__main__":
display_svg_image(SVG_PATH) I suggest that you try some non-QT based rendered to rule-out a faulty SVG. If the issue is with QT, report it to upstream QT. |
Thanks for reporting and thanks @jcjgraf for your quick and conclusive analysis! Exact same issues with PySide6. I can only agree, and also remember that we had issues with Qt Svg before (see #423), so this is most likely a Qt issue. Especially as you show a perfectly fine screenshot with another imageviewer (Gtk-based I assume?) on the left. I would second reporting upstream, that could be really helpful! The chance of us doing some internal workaround - or even not using Qt - are near zero. So I would flag and close this for now. |
Thanks for the quick replies. On the left, I was using Xviewer, which indeed seems Gtk-based. Is there a GitHub repo where I can report this bug or should I do it on https://bugreports.qt.io? I have no experience with Qt. |
I don't know of any Github repo that is more than just a mirror. https://bugreports.qt.io/ is the way to go, thank you 😊 |
Thanks. The bug was reported: https://bugreports.qt.io/browse/QTBUG-122413 |
Thanks again for opening the issue on the Qt end. Sounds like this was actually recently solved by them. I currently don't have Qt 6.7 just yet, but will be sure to test it once I do and update here. |
Hi,
First of all, thanks for fixing my previous issue #748; I can now enjoy SVG files in my favorite image viewer.
However, I noticed weird rendering in some cases. In the first screenshot, you can see the desired result on the left and Vimiv on the right. It seems there's an issue regarding the background color.
When I zoom in further, something even stranger happens (second screenshot): the image is no longer a rectangle, some parts are protruding.
I don't know if there's something wrong with my machine or if this is a general issue.
The text was updated successfully, but these errors were encountered: