Click here to Skip to main content
15,894,100 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
How we can resize image in c++ without loosing its quality ? We can use GFL library also. I tried using StretchBlt.

What I have tried:

I tried using StretchBlt but quality of an image is losing, because of that I am not getting proper pixel value i want proper pixel value. Using GFL library I am getting that but speed is too slow. Can anyone help ?
Posted
Updated 11-Jul-16 12:44pm
Comments
F-ES Sitecore 11-Jul-16 9:10am    
If you are looking to make it bigger then you can't make it bigger without losing quality. I know they do it all the time on CSI and other TV shows, but that's not real life :)

[shameless self-promotion]
Have a look at my article: Plain C Resampling DLL[^].
[/shameless sel-promotion]
 
Share this answer
 
Comments
[no name] 11-Jul-16 11:48am    
A 5 for the shameless good link.
CPallini 11-Jul-16 12:54pm    
Thank you :-)
You must understand how an image is rendered to be able to answer the question.

When you select an image for display it has it's on intrinsic maximum resolution which is defined by the image's dimension (pixels).

The very best you can do, in terms of image quality, would be to display the image at it's full size. This is rarely possible as, for example, a 12 MP image would require a screen with 3000x4000 pixels.

To fit the picture on the screen, you're going to have to show only some of the pixels. For example, you could squeeze that picture onto a 1500x2000 pixel screen by only displaying every other pixel (i.e., half the data in each direction, which is 3 MP of the data). This means, of course, that some detail is lost.

In practical terms, you'll likely only be displaying something more like on 1 in 10 of the pixels in each direction (300x400) (i.e., 100th of the image's data). It will have even less detail.

Now, should the resizing be a non-integral divisor of the image, you'll get some internal algorithm's idea of how to display the data (if you're lucky) or some non-evenly-dispersed selection, some of the data just not quite right, or some missing rows/columns.

So, the answer to your question is: a larger rendition should, at least, preserve (or even enhance) the detail (so long you don't expand beyond the real image's dimensions). A smaller rendition will lose detail. The data is either displayed . . . or not.
 
Share this answer
 
What you are looking for is a special library made by Penelope Garcia (Criminal Minds) and Abby Sciuto (NCIS) (co-writers) for their exclusive usage .

In reality, it does not exist. Otherwise, a simple picture of the night sky with your smartphone would beat telescopes.
Improving resolution is a functionality od the same library above. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900