Vandrovnik 215 Posted October 30, 2022 Hello, I have noticed that in PDF exported using SynPdf, colors in PDF do not match original colors. I have created a test application, which displays colors on screen and allows to export them to PDF using SynPdf and using FastReport. Colors should be the same, but are not (RGB of the left bottom square should be 191, 0, 255, but is 223, 0, 255 using SynPdf). Is there something wrong in my export procedure, or is it a bug in SynPdf? Kind regards, Karel PdfColors-source.zip TestSynPdf.pdf TestFastReport.pdf Share this post Link to post
Brian Evans 109 Posted October 30, 2022 Examining the PDFs I see they store the image using different filters: DCTDecode (fastreport) vs FlateDecode (SynPdf). The first is basically JPEG (larger and often has color shifts in parts) while the second is like ZIP (smaller since the sample is a very uniform image). Are you comparing colors between PDFs or with the source image? Share this post Link to post
Vandrovnik 215 Posted October 30, 2022 1 hour ago, Brian Evans said: Examining the PDFs I see they store the image using different filters: DCTDecode (fastreport) vs FlateDecode (SynPdf). The first is basically JPEG (larger and often has color shifts in parts) while the second is like ZIP (smaller since the sample is a very uniform image). Are you comparing colors between PDFs or with the source image? I do compare both - SynPdf x original bitmap and SynPdf x Fastreport. Later I tried to open the PDF in another tools (online PDF viewers, MS Edge, Libre Office) and there are colors from TestSynPdf.pdf OK. So may be it is just a bug in Adobe Acrobat Reader? Share this post Link to post
Attila Kovacs 631 Posted October 30, 2022 Those bitmaps are set up diffeently, like pf32bit / pf24bit who knows what else? Could you check them with the same setup? Share this post Link to post
Vandrovnik 215 Posted October 30, 2022 2 hours ago, Attila Kovacs said: Those bitmaps are set up diffeently, like pf32bit / pf24bit who knows what else? Could you check them with the same setup? Hmm, I forget to put pf24bit back and left pf32bit in the app, but the result is the same with pf24bit and pf32bit. Share this post Link to post
Vandrovnik 215 Posted October 30, 2022 4 hours ago, Brian Evans said: Examining the PDFs I see they store the image using different filters: DCTDecode (fastreport) vs FlateDecode (SynPdf). The first is basically JPEG (larger and often has color shifts in parts) while the second is like ZIP (smaller since the sample is a very uniform image). Are you comparing colors between PDFs or with the source image? I have created and atteched another output using SynPdf - now I enforced JPG compression of the bitmap, so that it also uses filter DCTDecode. Problem remains, colors do not match. TestSynPdf-jpg.pdf Share this post Link to post
Vandrovnik 215 Posted October 30, 2022 There is an ICC profile included in the PDF. I extracted ICC from Fastreport's PDF, put it in SynPdf, created new export - and colors are OK (or at least "almost OK" - expected value 255, displayed value 254). Share this post Link to post
Vandrovnik 215 Posted October 30, 2022 It seems Fastreport is using this color profile: C:\Windows\System32\spool\drivers\color\sRGB Color Space Profile.icm Share this post Link to post
rvk 44 Posted October 31, 2022 (edited) Can you compare those PDF's. The one from Fastreport is PDFA-1A. The one from SynPDF is not. Why didn't you create the one from SynPDF to also be PDFA-1A ? (in which case I think there will be an ICC written too) Edited October 31, 2022 by rvk Share this post Link to post
Vandrovnik 215 Posted October 31, 2022 1 hour ago, rvk said: Can you compare those PDF's. The one from Fastreport is PDFA-1A. The one from SynPDF is not. Why didn't you create the one from SynPDF to also be PDFA-1A ? (in which case I think there will be an ICC written too) I believe PDF from SynPDF is PDFA-1A, too. In source, I have: lPdf.PDFA1 := true; And Reader says: In the .pdf file, there IS a color profile included, and it seems that this profile is the source of the problem. When I made SynPdf to include another color profile (sRGB Color Space Profile.icm), colors are OK. Share this post Link to post
rvk 44 Posted October 31, 2022 48 minutes ago, Vandrovnik said: I believe PDF from SynPDF is PDFA-1A, too. In source, I have: lPdf.PDFA1 := true; Ah, yes, I missed that. There are several online validators and the ones I tried first said they were not PDFA. But others did. Included Color profile: TestSynPdf: ColorSync color profile 2.1, type ADBE, RGB/XYZ-mntr device by ADBE, 560 bytes, 11-8-2000 19:51:59 "Adobe RGB (1998)" TestFastReport: Microsoft color profile 2.1, type Lino, RGB/XYZ-mntr device, IEC/sRGB model by HP, 3144 bytes, 9-2-1998 6:49:00 "sRGB IEC61966-2.1" I think you would need to "hack" SynPDF to include a different profile (at least as I can see there is no property for it yet). On 10/30/2022 at 10:29 AM, Vandrovnik said: RGB of the left bottom square should be 191, 0, 255, but is 223, 0, 255 using SynPdf Is there a right and wrong in this? I found some source: large.icc: ColorSync color profile 2.1, type APPL, RGB/Lab-prtr device by bICC, 1613600 bytes, 30-8-2007 17:29:41 "MOAB Anasazi Canvas IPF5000.icc" middle.icc: Microsoft color profile 2.1, type Lino, RGB/XYZ-mntr device, IEC/sRGB model by HP, 3144 bytes, 9-2-1998 6:49:00 "sRGB IEC61966-2.1" small.icc: ColorSync color profile 2.1, type ADBE, RGB/XYZ-mntr device by ADBE, 560 bytes, 3-6-1999, relative colorimetric "Adobe RGB (1998)" So SynPDF uses the small.icc (560 bytes) and FastReport uses middle.icc (3144 bytes). Share this post Link to post