PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

resultant images not correct
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4024
Page 1 of 1

Author:  doxdici [ Tue Oct 08, 2019 7:14 am ]
Post subject:  resultant images not correct

Hello,
I'm usign pdfsharp to extract images from pdf documents. In some cases, the parameter length of the image is not a multiple of (width *height). In this case, the resultat image is not correct, it results with a coloured background or with some missing pixels. What am I doing wrong? Thank you.

Author:  Thomas Hoevel [ Tue Oct 08, 2019 7:59 am ]
Post subject:  Re: resultant images not correct

Hi!
doxdici wrote:
What am I doing wrong?
Some tips about asking questions here can be found here: http://forum.pdfsharp.net/viewtopic.php?f=2&t=832

Images are usually compressed, so differences between length and width are to be expected.

Author:  doxdici [ Tue Oct 08, 2019 9:50 am ]
Post subject:  Re: resultant images not correct

Thomas Hoevel wrote:
Hi!
doxdici wrote:
What am I doing wrong?
Some tips about asking questions here can be found here: http://forum.pdfsharp.net/viewtopic.php?f=2&t=832

Images are usually compressed, so differences between length and width are to be expected.

But this is a png image, not a compressed file.
In any case, I don't understand why some pictures result as the file attached. The big majority are ok.

Attachments:
C10AImage2.png
C10AImage2.png [ 4.19 KiB | Viewed 4813 times ]

Author:  Thomas Hoevel [ Tue Oct 08, 2019 1:58 pm ]
Post subject:  Re: resultant images not correct

doxdici wrote:
But this is a png image, not a compressed file.
PDF files contain PDF images - and those are compressed.
The image can have 4 bits per pixel, or 8 bpp, or 24 bpp, or 1 bpp. They can be direct colour or they can have a colour palette.
There are many different cases that your code has to cover to support all images.
Maybe your code works for some cases, but fails for others.

The screen shot looks like you are not handling the colour palette properly.

Author:  doxdici [ Wed Oct 09, 2019 9:11 am ]
Post subject:  Re: resultant images not correct

Thomas Hoevel wrote:
doxdici wrote:
But this is a png image, not a compressed file.
PDF files contain PDF images - and those are compressed.
The image can have 4 bits per pixel, or 8 bpp, or 24 bpp, or 1 bpp. They can be direct colour or they can have a colour palette.
There are many different cases that your code has to cover to support all images.
Maybe your code works for some cases, but fails for others.

The screen shot looks like you are not handling the colour palette properly.

The majority result correct if I use 24bpp, but in this case the colour palette results not set (Entries result empty). If I use 24 bpp, the colour palette result set, but the imagines results with white lines, so not correct as before. The minority result uncorrect in anycases. The original image, related to the one posted before, is as attached.
Any suggestion?

Attachments:
Immagine.png
Immagine.png [ 17.62 KiB | Viewed 4794 times ]

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/