[okular] [Bug 370382] Using non-default size for custom stamp pixelates the stamp

Wladimir Palant bugzilla_noreply at kde.org
Mon Nov 10 21:02:34 GMT 2025


https://bugs.kde.org/show_bug.cgi?id=370382

--- Comment #17 from Wladimir Palant <psbkde at palant.de> ---
After some more testing I came to the same conclusions as comment #4:
`setPopplerStampAnnotationCustomImage` calculates image size with respect to a
page size of 595x842 for an A4 page. That’s roughly 2.8 pixels per mm meaning
72 DPI. It’s a pixel density that is neither sufficient for print nor for
displays, the size used here should in fact be around factor 4 larger.
Essentially the same quick-and-dirty work-around does the job for me:

diff --git a/generators/poppler/annots.cpp b/generators/poppler/annots.cpp
--- a/generators/poppler/annots.cpp
+++ b/generators/poppler/annots.cpp
@@ -294,17 +294,17 @@ static void setSharedAnnotationPropertie
    
popplerAnnotation->setModificationDate(okularAnnotation->modificationDate());
 }

 static void setPopplerStampAnnotationCustomImage(const Poppler::Page *page,
Poppler::StampAnnotation *pStampAnnotation, const Okular::StampAnnotation
*oStampAnnotation)
 {
     const QSize size = page->pageSize();
     const QRect rect =
Okular::AnnotationUtils::annotationGeometry(oStampAnnotation, size.width(),
size.height());

-    QImage image =
Okular::AnnotationUtils::loadStamp(oStampAnnotation->stampIconName(),
rect.size()).toImage();
+    QImage image =
Okular::AnnotationUtils::loadStamp(oStampAnnotation->stampIconName(),
rect.size() * 4).toImage();

     if (!image.isNull()) {
         pStampAnnotation->setStampCustomImage(image);
     }
 }

 static void updatePopplerAnnotationFromOkularAnnotation(const
Okular::TextAnnotation *oTextAnnotation, Poppler::TextAnnotation
*pTextAnnotation)
 {

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list