<div>hi all,</div><div><br></div><div>i'm trying to resize a jpg via fpc-image, this is the relevant code(adapted from <a href="http://wiki.freepascal.org/fcl-image">http://wiki.freepascal.org/fcl-image</a>):</div><div>
<br></div><div><br></div><div><font face="'courier new', monospace">uses</font></div><div><div><font face="'courier new', monospace"> fpimage, fpcanvas, FPImgCanv, fpreadjpeg,fpwritejpeg;</font></div><div>
<font face="'courier new', monospace"> </font></div></div><div><div><font face="'courier new', monospace">procedure TImgResize.Resample(AFileName:string);</font></div><div><font face="'courier new', monospace">var</font></div>
<div><font face="'courier new', monospace"> Image : TFPCustomImage;</font></div><div><font face="'courier new', monospace"> writer : TFPCustomImageWriter;</font></div><div><font face="'courier new', monospace"> Reader : TFPReaderJPEG;</font></div>
<div><font face="'courier new', monospace"> Canvas : TFPCustomCanvas;</font></div><div><font face="'courier new', monospace">begin</font></div><div><font face="'courier new', monospace"> // Create an image</font></div>
<div><font face="'courier new', monospace"> Image := TFPMemoryImage.Create(224,150);</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> Reader := TFPReaderJPEG.Create;</font></div>
<div><font face="'courier new', monospace"> Image.LoadFromFile(AFileName (*, Reader*) );</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> //Image.SetSize(224,150);</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> // Attach the image to the canvas</font></div><div><font face="'courier new', monospace"> Canvas := TFPImageCanvas.Create(image);</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> // Create the writer</font></div><div><font face="'courier new', monospace"> Writer := TFPWriterJPEG.Create;</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> // Save to file</font></div><div><font face="'courier new', monospace"> Image.SetSize(224,150);</font></div>
<div><font face="'courier new', monospace"> Image.SaveToFile(AFileName+'b.jpg' (*, writer*) );</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> Canvas.Free;</font></div>
<div><font face="'courier new', monospace"> Image.Free;</font></div><div><font face="'courier new', monospace"> Writer.Free;</font></div><div><font face="'courier new', monospace">end; </font> </div>
</div><div><br></div><div>actually, Image.SetSize(224,150); causes half of the resulting image being black!</div><div>is it a bug or am i colling it wrongly?</div><br><br>--<br>Tazio Mirandola<br>Consulenza Software e Web<br>
Cel:348 0836782 Skype:tazio.mirandola <a href="Http://evidenceweb.it">Http://evidenceweb.it</a><br><table border="0" cellpadding="0" cellspacing="0" width="550"><tbody></tbody></table><br>