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

Patrick Holthaus bugzilla_noreply at kde.org
Tue Oct 7 10:22:23 BST 2025


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

Patrick Holthaus <patrick.holthaus at googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |patrick.holthaus at googlemail
                   |                            |.com

--- Comment #15 from Patrick Holthaus <patrick.holthaus at googlemail.com> ---
(In reply to Keyu Tao from comment #4)
> This looks like a bug related to QPixmap scaling and DPI stuffs. In
> setPopplerStampAnnotationCustomImage() it calls
> Okular::AnnotationUtils::loadStamp() with a rect size calculated from page
> size and annotation size. However it looks like this code assumes that 1 pts
> = 1 pixel on screen (72 DPI?), then in Okular::AnnotationUtils::loadStamp()
> the stamp is scaled too small, and results in a blurry result.
> setStampCustomImage() stores the scaled image in PDF, so stamps saved by
> Okular would also be blurry in other PDF readers.
> 
> A very dirty workaround is to enforce it to be at least 288 (=72*4) DPI in
> setPopplerStampAnnotationCustomImage():
> 
> diff --git a/generators/poppler/annots.cpp b/generators/poppler/annots.cpp
> index 20ad117ea..9d0680919 100644
> --- a/generators/poppler/annots.cpp
> +++ b/generators/poppler/annots.cpp
> @@ -285,7 +285,7 @@ static void setPopplerStampAnnotationCustomImage(const
> Poppler::Page *page, Popp
>      const QSize size = page->pageSize();
>      const QRect rect =
> Okular::AnnotationUtils::annotationGeometry(oStampAnnotation, size.width(),
> size.height());
>  
> -    QImage image =
> Okular::AnnotationUtils::loadStamp(oStampAnnotation->stampIconName(),
> qMax(rect.width(), rect.height())).toImage();
> +    QImage image =
> Okular::AnnotationUtils::loadStamp(oStampAnnotation->stampIconName(),
> qMax(rect.width(), rect.height())*4).toImage();
>  
>      if (!image.isNull()) {
>          pStampAnnotation->setStampCustomImage(image);
> 
> 
> I don't think it's a nice fix that should be included in upstream, but at
> least my signature image looks clear with this workaround.

This workaround helps in my case, too. Thanks for posting it - the stamp
feature is very useful with image overlays and it didn't work for a while now.

Okular 25.08 and 25.08.01 still seem to have that bug.

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


More information about the Okular-devel mailing list