<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16890" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2>Yeah, those issues are what drove my choice of
Graphics32 (image quality and scaling).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2>Here's some code which uses Graphics32 to resample an
image.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2>OldBitmap, TempBitmap are of type
Graphics32.TBitmap32</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2>NewBitmap is of
type Graphics.TBitmap;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2> OldBitmap.Assign(a regular Graphics.TBitmap here
which you could load using GraphicEx);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2> TempBitmap := TBitmap32.Create;<BR>
try<BR> TempBitmap.Width := Trunc(OldBitmap.Width *
Scale);<BR> TempBitmap.Height := Trunc(OldBitmap.Height *
Scale);</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2> rs :=
TKernelResampler.Create(OldBitmap);</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2> if FastResamplingWanted
then<BR> rs.Kernel :=
THermiteKernel.Create<BR>
else<BR> rs.Kernel :=
TLanczosKernel.Create;</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2>
GR32_Resamplers.StretchTransfer(TempBitmap,<BR>
Rect(0, 0, TempBitmap.Width,
TempBitmap.Height),<BR>
Rect(0, 0, TempBitmap.Width,
TempBitmap.Height),<BR>
OldBitmap,<BR>
Rect(0, 0, OldBitmap.Width,
OldBitmap.Height),<BR>
rs, dmBlend, Nil);</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2> NewBitmap.Assign(TempBitmap);<BR>
finally<BR> TempBitmap.Free;<BR>
end;<BR></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2>I've paraphrased this from some code of mine, but hopefully
that's the gist of a high-quality resample for you using
Graphics32.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2>Cheers,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=821502303-13102009><FONT face=Arial
color=#0000ff size=2>Conor</DIV></FONT></SPAN><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> delphi-bounces@delphi.org.nz
[mailto:delphi-bounces@delphi.org.nz] <B>On Behalf Of </B>Jeremy
Coulter<BR><B>Sent:</B> Tuesday, 13 October 2009 4:09 p.m.<BR><B>To:</B> NZ
Borland Developers Group - Delphi List<BR><B>Subject:</B> Re: [DUG] Image
manipulation<BR></FONT><BR></DIV>
<DIV></DIV>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.<BR>I needed one that did scaling so that the aspect
ratio was retained. It seems to work ok.<BR><BR>Jeremy<BR><BR>
<DIV class=gmail_quote>On Tue, Oct 13, 2009 at 4:05 PM, Kyley Harris <SPAN
dir=ltr><<A
href="mailto:Kyley@harrissoftware.com">Kyley@harrissoftware.com</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">GraphicsEx
is great.. but I do everything with BMP and JPG only<BR><BR>
<DIV class=gmail_quote>
<DIV class=im>On Tue, Oct 13, 2009 at 3:43 PM, Robert martin <SPAN
dir=ltr><<A href="mailto:rob@chreos.co.nz"
target=_blank>rob@chreos.co.nz</A>></SPAN> wrote:<BR></DIV>
<DIV>
<DIV></DIV>
<DIV class=h5>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Hi<BR><BR>We
want to do some basic image manipulation. Specifically the
following<BR><BR>1) open and dipslay Gif, jpg, and png image formats.<BR>2)
Resize the above file format<BR>3) Save file back in resized
format.<BR><BR>Does anyone have or recommend any code for doing
such?<BR><BR>I have seen GraphixEx but it states it does not support saving
of
images.<BR><BR>Cheers<BR>Rob<BR><BR>_______________________________________________<BR>NZ
Borland Developers Group - Delphi mailing list<BR>Post: <A
href="mailto:delphi@delphi.org.nz"
target=_blank>delphi@delphi.org.nz</A><BR>Admin: <A
href="http://delphi.org.nz/mailman/listinfo/delphi"
target=_blank>http://delphi.org.nz/mailman/listinfo/delphi</A><BR>Unsubscribe:
send an email to <A href="mailto:delphi-request@delphi.org.nz"
target=_blank>delphi-request@delphi.org.nz</A> with Subject:
unsubscribe<BR></BLOCKQUOTE></DIV></DIV></DIV><FONT color=#888888><BR><BR
clear=all><BR>-- <BR>Kyley Harris<BR>Harris
Software<BR>+64-21-671-821<BR></FONT><BR>_______________________________________________<BR>NZ
Borland Developers Group - Delphi mailing list<BR>Post: <A
href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</A><BR>Admin: <A
href="http://delphi.org.nz/mailman/listinfo/delphi"
target=_blank>http://delphi.org.nz/mailman/listinfo/delphi</A><BR>Unsubscribe:
send an email to <A
href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</A>
with Subject: unsubscribe<BR></BLOCKQUOTE></DIV><BR></BODY></HTML>