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, June 9, 2008 4:30:52 AM(UTC)

nick  
nick

Groups: Registered
Posts: 8


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
 

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 : Monday, June 9, 2008 4:34:31 AM(UTC)

nick  
nick

Groups: Registered
Posts: 8


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)
 
#3 Posted : Monday, June 9, 2008 5:04:01 AM(UTC)

nick  
nick

Groups: Registered
Posts: 8


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)
 
#4 Posted : Tuesday, June 10, 2008 3:56:07 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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


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.

 
#5 Posted : Tuesday, June 10, 2008 4:07:11 AM(UTC)

nick  
nick

Groups: Registered
Posts: 8


Thanks, i will try this out.

I want to accomplish something like this (from Coreldraw)
nick attached the following image(s):
Naamloos.jpg
 
#6 Posted : Wednesday, June 11, 2008 4:41:44 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

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.
 
#7 Posted : Friday, June 13, 2008 3:02:09 AM(UTC)

nick  
nick

Groups: Registered
Posts: 8


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
 
#8 Posted : Sunday, June 15, 2008 5:02:20 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

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.

 
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-2024, Yet Another Forum.NET
This page was generated in 0.382 seconds.