PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 7:34 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Oct 08, 2019 7:14 am 
Offline

Joined: Tue Oct 08, 2019 6:47 am
Posts: 5
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.


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 08, 2019 7:59 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 08, 2019 9:50 am 
Offline

Joined: Tue Oct 08, 2019 6:47 am
Posts: 5
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 8488 times ]
Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 08, 2019 1:58 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 09, 2019 9:11 am 
Offline

Joined: Tue Oct 08, 2019 6:47 am
Posts: 5
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 8469 times ]
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 127 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group