Using the "custom stamp from PNG/SVG file" feature in okular 0.26.70 to e.g. add a signature to a PDF will result in the signature being pixelated with varying resolution if the size of the stamp is determined manually with click+drag during creation. This problem affects both PNG and SVG stamps. The pixel size is roughly 1 mm, but it varies. This is probably caused in the source by importing the custom stamp file as icon instead of using the same way as the other SVG stamps shipped with okular.
Confirmed. But it's only seen at a low zoom setting; zoom in and you'll see that it's still got its full resolution.
I know this is old.. but for me this bus is still present in version 21.12.2 . It would be very nice to be able to add a high-res signature with the custom stamp feature. The stamp/signature is pixelated for me for both options: click or click/hold/drag. For click only: It shows clear on click, yet pixelates on release. It does not have its full resolution when zoomed in..
This is still the case in Okular 23.08.2. It would be really nice if this got fixed! I have my signature as an SVG file and am trying to an Okular stamp to insert my signature into a document and then use the "Print to PDF" functionality to generate a signed PDF to send. However, the signature is so blurry that it really cannot be used.
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.