PDF-XChange - Tracker PDF Viewer - TIFF-XChange - Image-XChange - XMF-XChange - Raster-XChange - Support

Moderators: TrackerSupp-Daniel, Tracker Support, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
 
whoit
User
Topic Author
Posts: 257
Joined: Tue Jul 07, 2015 3:30 pm

Image loaded for Annotation is too small

Thu Jul 12, 2018 7:46 pm

Hi -

I'm experiencing a problem where I load any raster image from file and the resulting size is too small.

Specifically, I have a 100x100 pixel sample that is loaded as 72x72 and of course is too small
when placed onto a page.
This happens with every raster image I try - bmp, jpg, png.

I'm using the CoreAPI C# Sample code from Alex (https://github.com/tracker-software/PDF ... oreAPIDemo)
and looking at the values returned in this line:

//LoadStampFromTheImageFile
si.GetSize(out nWidth, out nHeight);


Can you please address this?

Thanks,
Wayne
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3277
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Image loaded for Annotation is too small

Fri Jul 13, 2018 6:34 am

Hello Wayne,

Are you able to reproduce in the "6.4. Load stamp from image file" sample itself (24*24 image is being loaded there)?

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
whoit
User
Topic Author
Posts: 257
Joined: Tue Jul 07, 2015 3:30 pm

Re: Image loaded for Annotation is too small

Fri Jul 13, 2018 1:50 pm

Hi Alex -

OK, I did some more testing and this is what I found:

1) I have two sample images - A.png and B.png
A.png is 72x72 @ 72dpi
B.png is 80x31 @ 150dpi

2) When I use A.png as an IPXC_Image (for general placement on a page)
IPXC_Image AImage = pDoc.AddImageFromFile("A.png");

it is returned as 72x72 pixels

When I use A.png as an Annotation Image loaded into a Collection, etc.:
IAFS_File tmpFile = fsInst.DefaultFileSys.OpenFile(tmpName, openFileFlags);

it is also returned as 72x72 pixels.

3) However, if I use B.png in both scenarios,
when loaded as an IPXC_Image it is returned as 80x31 (the dpi is ignored)
but when loaded for an Annotation it is returned as 38x15 (the dpi is implemented)

So, my questions are:

A) Why does one method return the size without regard to dpi (IPXC_Image)
but the other method (Annotation) returns the size based on 72 dpi ?

B) How can I ensure that regardless of the "image loading method" that I use, I can get
consistent results without first knowing the image dpi?
For example, how can I ensure that both of the above sample images either adhere to
72dpi, or ignore the dpi ?

Thanks....
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3277
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Image loaded for Annotation is too small

Tue Jul 17, 2018 6:20 am

Hello Wayne,

This behavior occurs, because you have different measurement unit types - the IIXC_Page (like every raster) has pixel unit type. The DPI is used to convert pixels into the metrical units.
When you convert PNG into PDF, our converter takes the image DPI into an account and creates a content with corresponding size (and the size of the content is measured in points).
Thus 72 pixels with 72 DPI equal 1 inch (72/72) that equals 72 points for the first image.
As for the second image, 80 pixels with 150 DPI will equal 72*80/150 = 38.4 points.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
whoit
User
Topic Author
Posts: 257
Joined: Tue Jul 07, 2015 3:30 pm

Re: Image loaded for Annotation is too small

Tue Jul 17, 2018 12:22 pm

Hi Alex -

So the basic answer is that a raster file when used for Annotation is actually converted to a PDF format,
which then implements the original image DPI - Correct?
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3277
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Image loaded for Annotation is too small

Tue Jul 17, 2018 12:38 pm

Hello Wayne,

Basically this is a short answer:
When you convert PNG into PDF, our converter takes the image DPI into an account and creates a content with corresponding size (and the size of the content is measured in points).


Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Who is online

Users browsing this forum: No registered users and 1 guest