Hi,
I have a Pdf that contains 300 dpi Tifs,
get the Tifs with PXCp_ImageGetFromPage (C#) from the pdf doc,
set PXCp_SaveImageOptions.xDpi = 0 (the x-resolution of the image),
set PXCp_SaveImageOptions.yDpi = 0 (the y-resolution of the image),
write them with PXCp_SaveDocImageIntoFileW (C#) to a tif File.
When I look to the tif’s properties
I see 2485 * 3483 Pixel,
96 dpi as Resolution
When I calculate, knowing it’s a DIN A4 doc (21cm * 29.6cm) and it has 300 dpi
(xPixel * InchInTenthMm) / (DpiX * 10) = (2458 * 254) / (300 * 10) = 208,11 => ca 20,8 cm, about A4 width
(yPixel * InchInTenthMm) / (DpiY * 10) = (3483 * 254) / (300 * 10) = 294,89 => ca 29,5 cm, about A4 height
I know, the Information 96dpi is wrong.
But, where does it come from ?
Any suggestions for that ?
Thanks a lot
Robert
Getting wrong Tif resolution value
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Stefan - PDF-XChange
-
Stefan - PDF-XChange
- Site Admin
- Posts: 19939
- Joined: Mon Jan 12, 2009 8:07 am
Re: Getting wrong Tif resolution value
Hello Gemini64,
0 is an invalid value for DPI - so the default of 96 is used instead, and that's why your tiff files are then reported as 96 dpi.
Regards,
Stefan
0 is an invalid value for DPI - so the default of 96 is used instead, and that's why your tiff files are then reported as 96 dpi.
Regards,
Stefan
-
Gemini64
- User
- Posts: 13
- Joined: Thu May 02, 2013 10:21 am
Re: Getting wrong Tif resolution value
Thanks a lot,
in your XCPro40_Declares.cs I found the following declaration:
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct PXCp_SaveImageOptions
{
public int fmtID;
public int imgType;
public int bConvertToGray;
public int bDither; // 0 - disable; 1 - enable
public int bWriteAlpha;
public int xDPI; // 0 - use image's dpi
public int yDPI; // 0 - use image's dpi
public int CompressionMethod;
public int CompressionLevel;
public int bAppendToExisting;
};
So, I expected, the original resolution of the image was used, while saving.
Is there a way, to get the tif's original resolution ?
In this test szenario I knew it, but usually every resolution is possible.
Thanks
Robert
in your XCPro40_Declares.cs I found the following declaration:
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct PXCp_SaveImageOptions
{
public int fmtID;
public int imgType;
public int bConvertToGray;
public int bDither; // 0 - disable; 1 - enable
public int bWriteAlpha;
public int xDPI; // 0 - use image's dpi
public int yDPI; // 0 - use image's dpi
public int CompressionMethod;
public int CompressionLevel;
public int bAppendToExisting;
};
So, I expected, the original resolution of the image was used, while saving.
Is there a way, to get the tif's original resolution ?
In this test szenario I knew it, but usually every resolution is possible.
Thanks
Robert
-
Stefan - PDF-XChange
- Site Admin
- Posts: 19939
- Joined: Mon Jan 12, 2009 8:07 am
Re: Getting wrong Tif resolution value
Hi Robert,
You do get all the pixels of the tiff image - and what is reported as the intended DPI for tiff files is a separate piece of information.
Images inside a PDF file could be scaled... so the actual resolution inside the PDF would depend on the pixel count and the "physical" size of the image as placed on the PDF page and not on the value reported in the file details.
Best,
Stefan
You do get all the pixels of the tiff image - and what is reported as the intended DPI for tiff files is a separate piece of information.
Images inside a PDF file could be scaled... so the actual resolution inside the PDF would depend on the pixel count and the "physical" size of the image as placed on the PDF page and not on the value reported in the file details.
Best,
Stefan
-
Gemini64
- User
- Posts: 13
- Joined: Thu May 02, 2013 10:21 am
Re: Getting wrong Tif resolution value
Thank's, Stefan,
so I need to calculate it myself.
But that doesn't matter, I'll just use a computer
Regards
Robert
so I need to calculate it myself.
But that doesn't matter, I'll just use a computer
Regards
Robert
-
Stefan - PDF-XChange
- Site Admin
- Posts: 19939
- Joined: Mon Jan 12, 2009 8:07 am
Re: Getting wrong Tif resolution value
Or could just leave the default 96 
Unless of course you explicitly need this information for another part of your software.
Best,
Stefan
Unless of course you explicitly need this information for another part of your software.
Best,
Stefan