Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, March 30, 2009 9:04:28 AM(UTC)

daub815  
daub815

Groups: Registered
Posts: 4


I am doing a test with a jpeg2000 image (http://memory.loc.gov/gmd/gmd412/g4127/g4127l/ct001114.jp2), but am getting an odd result.  Here is my code for loading the JPEG2000 and converting it to an ImageSource:

                    RasterImage rasterImg = codecs.Load(this.m_url);
                    ImageSource img = Leadtools.Windows.Media.RasterImageMediaConverter.ConvertFrom(rasterImg, RasterImageMediaConverterFromFlags.None));

But when I look at the sizes of the rasterImg and the img they are not the same  The RasterImage is 6354 (width) by 3926 (height) and the ImageSource is 4066.56 (width) by 2512.64 (height).  At a glance, I don't see any pixel loss.  Is the image just being resized because the ImageSource can only hold a certain image size?  Why are they different sizes?
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, March 31, 2009 6:34:13 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

When you convert an image from a LEAD RasterImage to an ImageSource, the dimensions of the image are converted to the resolution units of the display, which are by default 96 dots per inch (DPI).

The image you tested does not have a DPI resolution value stored in it. When you load it into LEADTOOLS, it is given a default resolution value of 150 DPI.
This means its dimensions in inches are considered to be 42.36 x 26.17 inches.

These values correspond to the following dimensions at 96 DPI:
width = 6354/150.0*96 = 4066.56
height = 3926/150.0*96 = 2512.64
 
#3 Posted : Tuesday, March 31, 2009 6:40:33 AM(UTC)

daub815  
daub815

Groups: Registered
Posts: 4


So when I do the conversion, can I specify the DPI?  Thanks for your response.  It definitely explains my results.
 
#4 Posted : Tuesday, March 31, 2009 11:03:02 PM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

After you load the image, you can set the rasterImg.XResolution and rasterImg.YResolution to the screen DPI (which is usually 96).

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.121 seconds.