Yeah, those issues are what
drove my choice of Graphics32 (image quality and scaling).
Here's some code which uses
Graphics32 to resample an image.
OldBitmap, TempBitmap are of
type Graphics32.TBitmap32
NewBitmap is of
type Graphics.TBitmap;
OldBitmap.Assign(a regular
Graphics.TBitmap here which you could load using GraphicEx);
TempBitmap := TBitmap32.Create;
try
TempBitmap.Width := Trunc(OldBitmap.Width * Scale);
TempBitmap.Height := Trunc(OldBitmap.Height * Scale);
rs :=
TKernelResampler.Create(OldBitmap);
if FastResamplingWanted then
rs.Kernel := THermiteKernel.Create
else
rs.Kernel := TLanczosKernel.Create;
GR32_Resamplers.StretchTransfer(TempBitmap,
Rect(0, 0, TempBitmap.Width,
TempBitmap.Height),
Rect(0, 0, TempBitmap.Width,
TempBitmap.Height),
OldBitmap,
Rect(0, 0, OldBitmap.Width,
OldBitmap.Height),
rs, dmBlend, Nil);
NewBitmap.Assign(TempBitmap);
finally
TempBitmap.Free;
end;
I've paraphrased this from some
code of mine, but hopefully that's the gist of a high-quality resample
for you using Graphics32.
Cheers,
Conor
I have some code that I wrote form bits of other code off the net that
resizes images so they dont loose any quality. But like how Photoshop
does it etc.....well nearly.
I needed one that did scaling so that the aspect ratio was retained. It
seems to work ok.
Jeremy
On Tue, Oct 13, 2009 at 4:05 PM, Kyley
Harris
<ky...@harrissoftware.com>
wrote:
GraphicsEx
is great.. but I do everything with BMP and JPG only
Hi
We want to do some basic image manipulation. Specifically the following
1) open and dipslay Gif, jpg, and png image formats.
2) Resize the above file format
3) Save file back in resized format.
Does anyone have or recommend any code for doing such?
I have seen GraphixEx but it states it does not support saving of
images.
Cheers
Rob
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz
with Subject: unsubscribe
--
Kyley Harris
Harris Software
+64-21-671-821
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz
with Subject: unsubscribe
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe