Wizzard
Wizzard

Reputation: 12702

Resizing an image in Delphi XE

I got a jpeg image in which is 1020x780, I am trying to resize this to 111x85 (which is in proportion) but it comes out pixelated.

I am tried just

a) Assign the image to a TImage component and set the Scaled/Resize property.

b) The resize code here http://www.delphigroups.info/2/4/313095.html

c) The resize code here http://www.swissdelphicenter.ch/torry/showcode.php?id=1896

However they all come out pixelated.

If I resize in Photoshop then it comes out nice. Getting it THAT good would be ideal, however I know they spent a lot of time/code into resize so something even halfway between would be great.

Any suggestions?

Upvotes: 0

Views: 10867

Answers (4)

Stuart
Stuart

Reputation: 393

I have successfully used HiComponents ImageEn library to resize an image down to approx 250 pixels. It was a while ago, but I recall that the results were quite pleasing. http://www.hicomponents.com/main/products/products-imageenvcl - it's free now, and well worth a look if you're doing any graphics programming in Delphi.

Upvotes: 1

kludg
kludg

Reputation: 27493

Have a look at Graphics32 library. It implements various image resampling and transformation algorithms for 32-bit bitmaps.

Upvotes: 6

In my blog I talk about resize images using/implementing antialiasing.
Read the article and test the code here. It's writed in Spanish but you can use authomatic translate. In any case you can read only the code.

See the difference of apply and not apply the code:

enter image description here

The code work with BMP, but you can convert the image first and apply it.

Upvotes: 5

Frank Schmitt
Frank Schmitt

Reputation: 30775

Instead of using the built-in TImage for scaling, you could use an external library or component, e.g. ImageMagick or some off-the-shelf component. There exists at least one Pascal wrapper for ImageMagick

http://wiki.freepascal.org/PascalMagick)

, but I've never used it myself.

Upvotes: 1

Related Questions