Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Re: Using ColorResolutionCommand error
Started by nick@compufit at 06-09-2008 9:35. Topic has 7 replies.

Print Search « Previous Thread Next Thread »
  06-09-2008, 9:35
nick@compufit is not online. Last active: 6/9/2008 2:25:23 PM nick@compufit

Top 500 Posts
Joined on 06-09-2008
Posts 8
Using ColorResolutionCommand error
Reply Quote
i have this image 1024x786 with an 96 dpi, now i just want to change the dpi 48with the same size

this is my code, i alwyas get an exception:


the code is the attachement
   Report 
  06-09-2008, 9:39
nick@compufit is not online. Last active: 6/9/2008 2:25:23 PM nick@compufit

Top 500 Posts
Joined on 06-09-2008
Posts 8
Re: Using ColorResolutionCommand error
Reply Quote
the code:
RasterImage image = scanViewer.Image;
RasterSizeFlags flags = RasterSizeFlags.Resample;

ColorResolutionCommand colorResolutionCommand = new ColorResolutionCommand();
if (colorResolutionCommand != null)
{
colorResolutionCommand.BitsPerPixel = 48;
RunCommand(colorResolutionCommand, image);
}

IRasterCommand command = new SizeCommand(1024, 768, flags);
if (command != null)
{
RunCommand(command, image);
}

private void RunCommand(IRasterCommand pCommand, RasterImage pImage)
{
try
{
pCommand.Run(pImage);
}
catch
{ }
}

Leadtools.RasterException was caught
Message="Extended grayscale support is required"
Source="Leadtools"
StackTrace:
bij Leadtools.RasterException.CheckErrorCode(Int32 code)
bij Leadtools.ImageProcessing.RasterCommand.Run(RasterImage image)
bij Leadtools.ImageProcessing.ColorResolutionCommand.Run(RasterImage image)
bij Compufit.ScanTool.Scanner.RunCommand(IRasterCommand pCommand, RasterImage pImage) in C:\SourceCode\Oxygen\trunk\Compufit ScanTool\Compufit.ScanTool\Scanner.cs:regel 1985 i get the error also witht the demo (MainDemo.cs)

   Report 
  06-09-2008, 10:09
nick@compufit is not online. Last active: 6/9/2008 2:25:23 PM nick@compufit

Top 500 Posts
Joined on 06-09-2008
Posts 8
Re: Using ColorResolutionCommand error
Reply Quote
I think i dont need the ColorResolutionCommand, but something else, but what?

the ColorResolutionCommand reduces the number of colors, i want the same numbers of colors. Just lower quality (dpi)
   Report 
  06-10-2008, 9:01
Adam Boulad is not online. Last active: 7/23/2008 4:14:05 PM Adam Boulad



Top 10 Posts
Joined on 09-16-2007
Posts 406
Re: Using ColorResolutionCommand error
Reply Quote

Nick,

The ColorResolutionCommand Class does not change the DPI or size of the image, this class will change the Bits-Per-Pixel of the image.

 

LEADTOOLS does not take the DPI into consideration when loading the image. it is just a number that you can simply set to the value that you want.

You can set the RasterImage.XResolution and RasterImage.YResolution property which will change the DPI without changing the number of pixels in the image.

 

If you want to change the number of pixels so that the physical size (in inches) stays the same when the DPI resolution changes, you must use the ResizeCommand Class to resize the image and keep the value of (Pixels / DPI) fixed. In other words, if you decrease DPI by a factor of 2, you must decrease the pixel width and height by the same factor.


Adam Boulad
LEADTOOLS Technical Support

   Report 
  06-10-2008, 9:12
nick@compufit is not online. Last active: 6/9/2008 2:25:23 PM nick@compufit

Top 500 Posts
Joined on 06-09-2008
Posts 8
Re: Using ColorResolutionCommand error

Attachment: Naamloos.jpg
Reply Quote
Thanks, i will try this out.

I want to accomplish something like this (from Coreldraw)


   Report 
  06-11-2008, 9:46
Adam Boulad is not online. Last active: 7/23/2008 4:14:05 PM Adam Boulad



Top 10 Posts
Joined on 09-16-2007
Posts 406
Re: Using ColorResolutionCommand error
Reply Quote
Keep in mind that the X and Y resolution values in LEADTOOLS are always in dots (pixels) per inch. This means if you want to use other units, you must convert the value.
For example, if the image width is 2550 pixels and its XRes is 300 DPI, its width will be 2550/300, which is 8.5 inches. The same size in centimeters will be 8.5 * (2.54 cm/inch) which is 21.59 cm.
Adam Boulad
LEADTOOLS Technical Support

   Report 
  06-13-2008, 8:07
nick@compufit is not online. Last active: 6/9/2008 2:25:23 PM nick@compufit

Top 500 Posts
Joined on 06-09-2008
Posts 8
Re: Using ColorResolutionCommand error
Reply Quote
I think me misunderstand each other
I want this to do with the image:

orginal image: 1024*786 96pdi

changed to

new image: 1024*786 48dpi

result

same size (witdh/height), just lower quality
   Report 
  06-15-2008, 10:07
Adam Boulad is not online. Last active: 7/23/2008 4:14:05 PM Adam Boulad



Top 10 Posts
Joined on 09-16-2007
Posts 406
Re: Using ColorResolutionCommand error
Reply Quote
In LEADTOOLS, changing the DPI value has absolutely no effect on display quality. If the image is 1024*786 pixels, LEADTOOLS will display it exactly the same regardless of what DPI value it has.

If you only want to change the values of horizontal and vertical dots per inch resolutions, all you have to do is set the XResolution Property (RasterImage) and YResolution Property (RasterImage) to a different value. If you save the image in a format that supports storing DPI, the new values will be stored in the file.

Again, changing these 2 numbers has no effect on the image quality, no effect on its size in memory, and no effect on its size on disk when you save it in any format.


Adam Boulad
LEADTOOLS Technical Support

   Report 
Post
LEAD Support Fo... » Developer » DotNet » Re: Using ColorResolutionCommand error

Powered by Community Server, by Telligent Systems